Firebase Dynamic Links Opening all of my domain links in the app - ios

I'm using a custom domain for Firebase Dynamic Links in my Unity app. The domain is in the format https://mywebsite.com/deeplink/
On Android, this all works fine. Going to mywebsite.com by clicking a link in an email or the browser, opens the URL in the browser and mywebsite.com/deeplink opens the app. On iOS, however, both open the app. This includes, most troubling, the mywebsite.com/_/ URL which Firebase uses for its confirm your email and reset password logic.
My app is configured with applinks:mywebsite.com in the associated domains section and the PList has an entry for FirebaseDynamicLinksCustomDomains with an array that has https://mywebsite.com/deeplink as an entry.
mywebsite.com/apple-site-association has this
{"applinks":{"apps":[],"details":[{"appID":"LK3H8YP4D2.com.help.stressfree","paths":["NOT /_/*","/*"]}]}}
Does anyone have an idea why this is happening and how I can get the app to only open URLs at mywebsite.com/deeplink?

The root domain of your custom Dynamic Link mywebsite.com shouldn't be added in the Associated Domains list. That's the reason why mywebsite.com opens the app in iOS.
Only Google-provided domains (*.page.link) should be added in the Associated Domains list.
https://firebase.google.com/docs/dynamic-links/ios/receive#open-dynamic-links-in-your-app

Related

Unexpected password autofill with Firebase Dynamic Links

I have integrated Firebase Dynamics Links into my app (using <myapp>.page.link domain) and it's all working fine. However, I have now found that in my login and registration screens I get username/password autofill appearing for website page.link. I'm not currently using autofill, and don't have the webcredentials entitlement, so this is very strange. Has anyone else come across this and know how to prevent it?
I'm seeing it every time for each new project with dynamic links.
I think that firebase's apple-app-site-association posted at <yourapp>.page.link is the only credible source of info it can find (even though it doesn't have webcredentials). Basically it looks like after failing to find webcredentials anywhere it falls back to the only available file with applinks.
The easiest way to prevent this is to take initiative from firebase and post own apple-app-site-association file with webcredentials at your site (with proper "webcredentials:<your.domain>" counterpart added into the Associated Domains capability).

iOS URL scheme or not existing Universal Link

I was developing Android App that could be opened by url link sent to email. The domain exist but the path not (ex. google.com/abcdefgh1234). Im not an owner of the website so putting AASA file there is not possible. The link also contained jwt with some info that I was handling in the app. I wanted to do the same on ios but what I found, URL schemes doesn't support http and Universal Links need special file on that website. Is there a way to handle this on iOS?
You can check custom URL scheme https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app
It will work without adding special file to the server. You need only a special link and after a tap on it, you will be redirected to that app (if it exists on your phone). Maybe this is what are you looking for

ios Universal Links - from multiple domains

I have a question about the apple-app-site-association and where it should be deployed in the case where I have 2 (or more) websites that are going to display a URL that will direct a user to my app.
For instance, I have a main website where my AASA file is deployed here:
www.my-main-domain.com/.well-known/apple-app-site-association
With a wildcard in it like this:
"paths": ["/my-app/*"]
This means any link like this:
www.my-main-domain.com/my-app
Will open up in my app.
What if I have another website and I want to link to the app from there. The new site is:
www.my-other-domain.com
Can I link to the app using the same URL above? Do I need another AASA file deployed on the new domain?
Thanks
There is no need to make changes on this other site, I was given incorrect information. There was an issue with the way it was implemented in our app that was causing it to not work from other domains.

How to implement DeepLinking If user don't have app then?

I have 3 requirement for DeepLinking or Universal Links to my project.
If user is having the application then URL should redirect to application with content.
If user don't have the application then it should redirect to Appstore.
If user don't have the application then it should redirect to Appstore and after download the app it should go to that page with data which I am sending with URL.
Links which I followed:
https://www.raywenderlich.com/128948/universal-links-make-connection
https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html.
http://swiftdeveloperblog.com/deep-linking-using-custom-url-scheme/.
http://blogs.innovationm.com/deferred-deep-linking-in-ios-with-universal-link/
https://developer.apple.com/documentation/security/shared_web_credentials/preparing_your_app_and_website_to_share
http://www.brianjcoleman.com/tutorial-deep-linking-in-swift/.
What I understood is:
Creating and Uploading the Association File and for this I have to follow some steps:
Adding support for universal links is easy. There are three steps you need to take:
Create an apple-app-site-association file that contains JSON data about the URLs that your app can handle. Upload the apple-app-site-association file to your HTTPS web server. You can place the file at the root of your server or in the .well-known subdirectory. Prepare your app to handle universal links.
Creating and Uploading the Association File
To create a secure connection between your website and your app, you establish a trust relationship between them. You establish this relationship in two parts:
An apple-app-site-association file that you add to your website
A com.apple.developer.associated-domains entitlement that you add to your app
Preparing Your App to Handle Universal Links.
In your com.apple.developer.associated-domains entitlement, include a list of the domains that your app wants to handle as universal links. To do this in Xcode, open the Associated Domains section in the Capabilities tab and add an entry for each domain that your app supports, prefixed with applinks:, such as applinks:www.mywebsite.com.
Problem is: I followed all steps and I have a url I added it in the domain in my Associated Domain.
Example: https://<My_Domain>/anything.
Now Backend is generating URL and sending.
We are using Http server.
Example:
Route::get('appstore',function(){ return redirect()->away('https://itunes.apple.com/in/app/whatsapp-messenger/id310633997?mt=8');});
Problem is when I am clicking on that URL I am not getting any popup for already app and also After download how data I will get ?
Am missing something or backend is missing something?
So it seems like you are trying to accomplish deferred deep linking, which means you route the user to the content if the app is installed or you route the user to the app store to download the app and present them the content once the app is opened. This is very difficult to do by yourself and I'll explain more in a bit.
It looks like you are setting up your universal links correctly but the redirect to the app store is fairly hacky. Universal Links are meant to be used to redirect users to the web version, which means bringing them to the app store instead is no easy task.
If you do get the user to the app store, deferred deep linking which is just directing them to the content after they install the app is nearly impossible to do yourself without using a third-party service like Branch. Branch also will allow you to push users back to the app store to download the app, if that's the user experience your looking for.
Hope this helps!

iOS deeplink (universal Link) through sub Domain

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.

Resources