I'm wondering if Branch IO can cater for my use case.
I need to create a link that can do the following:
If the user is on a PC, direct them to the facebook website in their browser
eg. https://www.facebook.com/pg/sony
If the user is on IOS/Android and has the facebook app installed, deeplink them to the facebook app
eg. IOS: fb://page/sony
eg. ANDROID: fb://facewebmodal/f?href=https://www.facebook.com/sony
If the user is on IOS/Android and DOESN'T have the facebook app installed, send them to the facebook website via a browser
eg. https://www.facebook.com/pg/sony
I can do everything except step 3 with javascript, and in googling for an answer some have suggested that branch IO can help. I've struggled to make this work - here is the rule I have tried (I have removed my key on purpose)
curl -XPOST https://api.branch.io/v1/url \
-d '{
"branch_key": "my_key_removed_for_this_demo_purpose",
"channel": "facebook",
"campaign": "test",
"data": {
"$ios_url": "fb://page/sony",
"$desktop_url": "https://www.facebook.com/pg/sony",
"$android_url": "fb://facewebmodal/f?href=https://www.facebook.com/sony",
"$fallback_url": "https://www.facebook.com/pg/sony"
}
}'
When I attempt to access this link in chrome from my android phone, I'm greeted with a message stating "To view this content, install and set up a web browsing app".
Is my use case possible with Branch IO? (ie integrating with facebook & directing the user to the app if it is installed, otherwise using their browser & navigating to the appropriate facebook page).
I would really appreciate some help in making this work
Many thanks
You could do this by setting the uri_redirect_mode to make sure that the URI scheme is fired only when the app is present. You could read more on uri_redirect_mode here. If you are still facing issues, please write to integrations#branch.io and we would be happy to help you out.
Related
I have a a problem on a Nativescript 5.1.0 project with Angular 4, I use the API nativescript-oauth2, and it works fine for Facebook and Google, but when I try to Login into Microsoft it does not do very well.
I can enter the e-mail account and password, even the permission screen is shown, but in this one when I press YES it crashes.
The problem is because of the property redirect uri (urn:ietf:wg:oauth:2.0:oob) for the Microsoft configuration, when Safari receives the redirect uri, Safari crashes.
I read that can be solved with a delegate, but it already exists in the nativescript-oauth2.
And the android browser does not show the error but it does nothing.
Help me please!!
With Microsoft oAuth, it tries to open your app with an URL scheme. You might want to setup URL schemes in your app like it's showcased in demo app for Provider, iOS & Android
I have read a lot of articles regarding universal links but still i need to be clear regarding few things.
I have to add universal links to http://www.domain.com but due to certain reasons i will not be able to make my website SSL certified or even put apple-app-site-association with https in root folder. So I thought of doing this in a different way, i will put apple-app-site-association file in the root of a subdomain, lets say https://www.app.domain.com/apple-app-site-association
Then i will open every universal link with that subdomain whenever universal link is available and redirect https://www.app.domain.com to http://www.domain.com if universal link is not available.
Questions in my mind :-
apple says - file needs to be accessible via HTTPS—without any redirects—at https:///apple-app-site-association.
In this line what does apple mean by without any redirects ?
when apple does not find any universal link related to a particular URL, will it itself redirects it to safari.
Is this a safe way to add universal links or is it necessary to have our main domain on https or at-least apple-app-site-association on https
This should work fine. To explicitly answer your questions:
'Without redirects' means when iOS requests https://www.app.domain.com/apple-app-site-association, it must find the file at that address. You can't have a redirect of any kind (Javascript, 301, 302, etc)
If a URL is not valid for Universal Links because you didn't cover it using the inclusion rules in the apple-app-site-association file, it will be opened using Safari. If the URL is on another domain without a valid apple-app-site-association file (e.g., http://www.domain.com/), then it will also be opened in Safari.
Yes, it's fine. Definitely a workaround, but not unsafe.
You should also investigate a hosted deep linking service like Branch.io (full disclosure: I'm on the Branch team) or Firebase Dynamic Links. These will give you all of the same benefits (plus a bunch more flexibility, to be honest) without any of the setup headaches.
We experienced ways where a 302 on iOS works.
In general I fully agree that Apple officially does not seem to support any redirect.
The following cases have been tested on an iPhone 6 running iOS 11.
These cases work :
Website in Chrome on iOS: User clicks on link A and a 302 redirects him to a Universal link B.
Website in Safari on iOS: User clicks on link A and a 302 redirects him to a Universal link B.
Gmail App on iOS: User clicks on link in email and Gmail opens external Chrome browser, which opens a Google link which redirects to link A which redirects via 302 to Universal Link B. (this case works only if Chrome is installed and in Gmail Settings the user explicitly changed the default browser to Chrome)
These cases DO NOT work:
Apple Mail: User clicks on link A in email and external Safari is opened. 302 happens and opens Universal link B. Result: App does not open
Gmail App: User clicks on link A in email and Gmail inAppBrowser (probably WKWebview?) is opened. Gmail redirects EVERY link from an email over a google server, as a second step link A is opened (dont know via 302 or other method) then 302 happens and opens Universal link B. Result: App does not open
Unfortunately you can see that in some cases it does NOT work. As these cases, Apple Mail and Gmail on iOS are very important for most of us here, I think this is a showstopper and you should not use it.
We tested with Adjust links and therefore in cases where the app does not open Adjust opens the AppStore to download the app.
For all Adjust interested: We tested by opening a link https://app.adjust.com/... which has a 302 on the respective Universal link https://XXXXXXX.adj.st/... on which our app listens.
Our iphone app allows for sign in via Foursquare via oauth. It was working fine and recently stopped working.
The error we get is: Connecting Failure: Callback uri is not valid for this consumer.
HOWEVER, if the user does not have the foursquare app installed on their phone it works fine as before. It seems as if FS is now doing a redirect to handle the oauth inside the FS app and this fails when attempting to return to the originating application. Via safari it seems to work.
This is on ios 9.
Solutions?? Thanks!
We've changed to use a SafariViewController and this seems to force Foursquare to not to this strange in-app redirect, solving the issue. This is also Apple's preferred oauth method, so probably the way to go.
Still seems like a problem on the Foursquare side that they may want to address for others however. I'm closing this question. Thanks.
Where does your redirect URL point? If you want it to launch your app after completion you should point to the iTunes store (pre-iOS9) link for your app or the universal link (iOS9 onwards).
More information on redirects for the native foursquare app is available in the README here: https://github.com/foursquare/foursquare-ios-oauth/
How to create a universal link in iOS9 https://www.appsflyer.com/blog/how-to-set-up-ios-9-universal-links-for-your-app/
A callback url is a webpage loaded after your web app has been
verified. In this case, you need to specify a page for to send data to
after authentication
Double check your Foursquare credentials and update the callback uri to a valid link. Tutorial link
Please follow the below points, may be one resolves your issue:-
Enter the callback in foursquare account in addcallback methods. Then in your code add the call back to the provider before you authorize. (Reference here).
You're getting that error because the URL you're pointing your users to (foursquare.com/oauth2/...) includes a redirect_uri parameter that doesn't match with what you configured in your app's settings under https://foursquare.com/developers/apps. Make sure these match!
I am new in using oAuth and Yahoo! API in an iOS app. I am trying to access my Yahoo! contacts from my iOS app.
I have tried many ways found in StackOverflow. Most of those directed to http://developer.yahoo.com/social/rest_api_guide/contact_api.html; but, I really can not understand all the stuffs described there.
I also found another framework with example resource in https://github.com/yahoo/yos-social-objc.
I am working with this one (the example included in this framework) and got into a trouble here that, when I use the YOAuth to authenticate the app, it opens up the Safari browser and after log into the Yahoo! account is shows an Agreement page. And upon agreement it is showing a page with message
To complete sharing of Yahoo! info with MYAPP, enter code "THECODE" into MYAPP
I do not really know that, what to do with this?
Now I need someone to help me out with this so that, my app get authorized successfully and redirected to my app from Safari with a minimum overhead.
Thanks in advance.
I have found the solution though with a little overheads.
Steps are:
1> Create a PHP script in you own server (say named, YRedirect.php).
2> Pest the following code in it-
<?php
$query = $_SERVER['QUERY_STRING'];
header("Location: YOUR_APP_ID_OR_BUNDLE_ID://oauth-response?" . $query);
?>
3> Add an URL Scheme in your info.plist file with the YOUR_APP_ID_OR_BUNDLE_ID.
That's it and you are DONE with the authentication problem.
But, I am still on retrieving contact info from Yahoo!.
Thanks all.
I'm using this iOS Library https://github.com/crino/instagram-ios-sdk to login to instagram from my native app for sharing and getting feed from Instagram APIs. When i brought classes from this demo app to my project, here it is what happens:
Application successfully opens Authorization URL in safari and when i enter my credentials & authorize, it says "Safari cannot open address because its invalid" before redirecting to app or some time says "Redirect URI does not match registered URI".
Any help on this is appreciated.
You have to add URL scheme to your application's plist file, it's mentioned in short guide on github instragram page:
Make sure you've edited your application's .plist file properly, so that your applicaition binds to the ig[clientId]:// URL scheme (where [clientId] is your Instagram application CLIENT ID).
Here you'll find more information, see this article on TutsPlus: iOS SDK Working With URL Schemes
That error indicates that the URI you gave it is not handled by anything in the phone.
For example - the skype uri looks like skype:
IF skype is installed, it opens skype.
If skype is NOT installed, you get that same error.
You are either using the wrong URI (probably because you got the client-id wrong - do not include the [] in it), or, you do not have the Instagram app installed on your iOS device, or possibly you've messed with your instagram account and the app is not listening to that URI anymore.