I can't seem to get a response from Dropbox when I call any of the mergDropbox commands. I've setup an app on Dropbox, so I have an app key and secret to pass in the mergDropbox setup command but nothing happens when I do. All this works fine in the demo stack that comes with the external (which links me to Monte's demo Dropbox app) BTW.
I wonder if it has anything to do with the fact that my Dropbox app status is 'development' rather than 'production', but if it is then I'm unsure how to proceed as I am unable to apply for production status until I have successfully linked to the app - which seems like a catch 22 situation to me.
This question was asked on a mailing list, however, I thought the answer would be helpful to others so I'm posting here.
The problem that's occurring is you haven't set the custom url scheme required by the dropbox app to return to your app after linking. When you don't set this and you try and link the app then you don't switch to the Dropbox app and the dropbox sdk logs something like this:
[ERROR] DropboxSDK: unable to link; app isn't registered for correct URL scheme (db-c0sbjqyibf12hg1)
So what you need to do is enter db-yourappkey as your custom url scheme here:
Related
Project workspace
Mobile Project: ReactNative 0.64.3 / Expo with Managed Workflow / IOS 14.6 / NPM
Sharing Library: ReactNative's default Share library.
Website/Domain: Statically hosted via S3, single page app built with TS/Gatsby. Caching handled with CloudFront.
Synopsis: I'm using universal links and query params to allow my users to share tickets. The Universal links are being stripped of all route params and query strings when the link is shared by the native sharing dialog. Using the COPY/PASTE function in the native sharing dialog always copies a complete link, which can be pasted anywhere and used successfully to open the app. The EMAIL option also works, opening Mail with the correct url string and autofilled as expected. The problem arrises when I try to share the link via iMessage. I'm running the project on an iPhone as a fully deployed Apple Testflight standalone app.
The app does download the AASA file on app install, which is statically hosted via an S3 bucket. I have verified its availability via postman and the online AASA validator here https://branch.io/resources/aasa-validator/
The app always opens when opening a valid universal link, such as when I manually type it into iMessage or other sharing medium -- email, etc. Because of this, I'm inclined to believe I have a problem with where the link string is being generated rather than the AASA system.
const ticketShare = (ticket: Ticket) => {
const link = Linking.createURL("www.sample.com/share_ticket", { //Expo Linking library
scheme: "https",
queryParams: {
...ticket
}
}).replaceAll("%25", "%"); //double encoding problem I have yet to properly fix.
console.log("link: ", link); //always the correct url here.
Share.share({ url: link }); // request to open the native sharing dialog activity. ('url' for ios)
};
Correct url is something like:
https://www.sample.com/share_ticket?my=query¶ms=here
Stripped url is something like:
https://www.sample.com/
sharing dialog image.
https://www.sketchappsources.com/resources/source-image/simple-share-actionsheet-ios-13-hugo.png
"COPY" actions always copy the correct url, "MAIL" works as well.
Using "MESSAGE" or any of the "recent" actions in the top row fails, sharing the base url only.
The title and website abbreviation at the top of the action sheet do render properly, pulling metadata/images from the website.
To make it more complicated, the share function does yield the correct url directly after a fresh install, but then never again. Console.logs always log the correct url.
I have tried react-native-share's library with the same results. (Wraps the same native bridge code?)
I have checked the react-native github page for issues related to this with no result. I have combed StackOverflow for a few days without results. Usually that means its something simple.. here's to hoping.
Anyone out there run into this issue? Thanks!
I'm trying to register a custom protocol with electron. I want it to be a redirect location that a website can use to provide an api key (like myprotocol://example/payload=api-key). I have been using electron's registerHttpProtocol and also tried electron's interceptHttpProtocol.
But, when the website tries to redirect to my protocol my electron app doesn't do anything. The website goes to myprotocol://example/payload=api-key, and registers a "page doesn't exist error"--while nothing happens in my app.
This is in a development environment. I've seen some discussion about custom protocols that assume a production environment.
Can you register a custom protocol with electron in development?
Why am I not able to intercept the website's going to the protocol I've set out?
Here's my code:
main.js:
app.whenReady().then(() => {
protocol.registerHttpProtocol('examplep', (request, callback) => {
console.log("examplep", request);
callback('it-worked');
}, (error) => {
if (error) console.error('Failed to register protocol = ' + error)
})
protocol.interceptHttpProtocol("examplep", function (request, callback) { //I've tried both registerHttp... and interceptHttp... methods, so including both here; though I think in practice only one should be required
console.log('intercepted!' + request)
callback(request);
});
})
redirect url provided to website:
'http://examplep'
And I've whitelisted this url on the website itself.
I've also tried related methods registerStringProtocol, interceptStringProtocol, registerFileProtocol, and interceptFileProtocol, without success.
What am I missing?
Sounds like you need to support deep linking fora desktop app, which is done via a Custom URI Scheme and is registered with setAsDefaultProtocolClient.
When your Electron app starts up write this code to register the scheme, on the main side of your app:
const customScheme = 'x-mycompany-myapp';
app.setAsDefaultProtocolClient(customScheme);
The custom scheme can be tested from the command line like this, depending whether you are running macOS or Windows:
open x-mycompany-myapp:/some/location
start x-mycompany-myapp:/some/location
A web client will just invoke a URL as in this Javascript code of mine;
The notification will be received within the main side of your app and on Windows will attempt to create a new instance of the app, in which case you need to detect this condition, process the notification then cancel the new app instance.
On MacOS it will be received within the open-url event, so you register it like this:
app.on('open-url', this._onOpenUrl);
Once the main side of the Electron app has the notification, it needs to get the URL information and forward it to the renderer process. You can use ipcMain events for this.
Finally the code for receiving the notification in running instances and starting the app from a deep link are different.
EXAMPLE APP
Since the code is a little tricky, here is some example code that may be useful, to give you something to compare against. If it helps you can also run the app by following the instructions in the blog post:
Code
Blog Post
My use case is around receiving OAuth responses after signing in from the system browser. Hopefully you can borrow some ideas from it related to deep linking though.
INFO.PLIST
My understand is that in a development environment (on macOS) deep links work when the app is running, but if you stop the app and attempt a deep link it will not start the app.
You can only resolve this for a packaged app, which requires an info.plist. In my code sample the info.plist is generated from build protocol entries in the package.json file.
My code sample is packaged in a basic way by the Electron Packager, so when I run npm run pack, the app is built to a dist folder. I can then run the packaged version of the app and it gets registered with the system - as can be seen in the Default Apps tool. See screenshots in the blog post.
SECRETS
Secrets for a desktop app should be stored using operating system secure storage. There are screenshots of credential storage in the blog post.
On Electron, have a look at the keytar component - and this wrapper class of mine. I am storing tokens (strings) so you should be able to adapt the code for your API keys.
Our organization uses an enterprise account and the itms-services protocol to internally deploy apps over-the-air.
Our plists and ipas are hosted on Amazon S3 and everything works as expected - you click a link and an alert pops up asking if you'd like to install the app.
We are now trying to store our files on Firebase storage and send out links in the following format:
itms-services://?action=download-manifest&url=https://firebasestorage.googleapis.com/v0/b/my-app.appspot.com/o/MyApp.plist?alt=media&token=my-token
Pasting this link in Safari opens a dialog asking: 'Open this page in "iTunes"?' Clicking on open does nothing.
It's worth mentioning that if I upload the same plist/ipa combo to S3 it works fine. Also, if I paste the url itself (without the itms-services part) I am able to download both plist and ipa.
Why don't I get the dialog asking if I'd like to install the app? I have a feeling that it's somehow related to an issue with permissions to Firebase but as I am able to download the file directly I'm not really sure.
Your url should be encoded.
For example:
Normal url: https://firebasestorage.googleapis.com/v0/b/my-app.appspot.com/o/MyApp.plist?alt=media&token=my-token
Encoded url: https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Fmy-app.appspot.com%2Fo%2FMyApp.plist%3Falt%3Dmedia%26token%3Dmy-token
Finally: itms-services://?action=download-manifest&url=https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Fmy-app.appspot.com%2Fo%2FMyApp.plist%3Falt%3Dmedia%26token%3Dmy-token
gfvilela's solution worked in 2017 and if you have spaces you still need to do that but there is a new issue where firebase removes the // after itms-services: in redirects.
I used https://www.redirect-checker.org/index.php to check what my redirect actually redirects to and it shows that it's leaving out the //:
itms-services:?action=download-manifest&url=...
Somehow this still opens the popup "Open this page in Itunes" but it will not open the next popup "<domain> would like to install <app>" probably because the Itunes process that is opened parses the URL different from how iOS handles deeplinks.
I can only speculate but I think the problem with firebase removing the // lies with how they handle : since they use it with their "glob" pattern matching: https://firebase.google.com/docs/hosting/full-config.
Attempts
I tried encoding the entire URL, just the // part and even only the : but all of these redirect to mydomain.com/itms-services....
I tried using the Dynamic Links module but that doesn't support this either:
Please enter a valid URL starting with http:// or https://
Solution
I think the only way to do this using firebase is to redirect using functions similar to this question: Cloud function for firebase to redirect to a URL
This is definitely more work and is not included in the free firebase package but here is how I solved it:
run firebase init functions
Write the redirect in functions/index.js
exports.downloadApp = functions.https.onRequest((req, res) => {
res.redirect(302, 'itms-services://?action=download-manifest&url=<YOURMANIFEST>');
});
Run firebase deploy --only functions
In your firebase.json add a rewrite (not redirect) to the function:
"rewrites": [
{
"source": "/app",
"function": "downloadApp"
}
]
Run firebase deploy --only hosting
Note
This is an awful lot of workaround just because firebase doesn't have an escape character for : for when you don't want to use it for "glob" pattern matching.
How to Open an iOS App using Firebase Dynamic Links and Pass or get Parameters To an App Via Custom URL Scheme in iOS(swift)?
for eg :- https://q3tyj.app.goo.gl/abcd
My URL Scheme is ‘q3tyj.app.goo.gl’ in iOS app in Url Types.
If I type q3tyj.app.goo.gl in safari, I am able to open the application. But if I type q3tyj.app.goo.gl with some extra parameter like https://q3tyj.app.goo.gl/abcd in safari, , I am not able to open the application.
please also explain me how to get “link” parameter (which associated with dynamic link) from dynamic link in iOS app ( Swift ) .
I followed steps which were mentioned in Firebase.google.com for iOS ( Swift ).but its not working.
Thanks,
Nirav Virpara
It's hard to know exactly where your error is, but a few things to help you debug:
If you go to https://q3tyj.app.goo.gl/apple-app-site-association, you should see some JSON that points to your app. If you don't see this, make sure you've entered your team ID and your App Store ID in the project settings in the Firebase console
Make sure you're using your Bundle ID, not the shortlink domain, as your custom URL scheme in Xcode
Make sure you've enabled Associated Domains in the Capabilities tab of your Xcode project, and your domain looks like applinks:q3tyj.app.goo.gl
Universal Links (and, therefore, Dynamic Links) generally don't work if you type them directly into the Safari address bar. Instead, try typing the URL into an app like Notes and then clicking on them from there.
Good luck!
If you type https://q3tyj.app.goo.gl/apple-app-site-association this link in your browser and check, you will end up seeing a json, meaning your apple-app-site-association is correctly configured on your google website. However, you need to make sure that teamid in your google console or appid is correct.
Hi I have a requirement in my app. From my ios Application(myapp),i share a link to facebook. Then I opened up my facebook account in browser or Facebook application and clicked the link, link should open in myapp if myapp is installed in the device otherwise link should open in browser. How can I achieve this ? Please suggest me step by step. Thanks in advance for your consideration and help.
I am not sure if this is possible. I have looked at various questions including
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?
as I am sure you might have already done but these questions target their own app, mainly web app, but you want that behavior to occur from an app that is not yours like twitter or facebook. But what you can do is show them two links on facebook/twitter, if they have installed press link 1 and if they want to install, press link 2 and you can pass parameters in link 1 as you might already know.
I will also keep checking answer of this question if some one comes and gives a better solution.
There is an option called custom URL scheme in iOS. It will help you to create a URL scheme which identifies your application. You can post link with this URL scheme and when you tap on this link on your iOS device it will open up your mobile app. Please see the link below to know how to setup this.
Custom URL Scheme in iOS
This is called 'deep URL linking'. Facebook have built a service called 'App Links', which seems pretty cool.
https://developers.facebook.com/docs/ios/app-links