How to edit the apple-app-site-association file auto-generated by Firebase Dynamic Links? - ios

Whenever I create a new url prefix using free Google-provided domain (for example, yourapp.page.link). The apple-app-site-association file gets automatically created at the respective https://yourapp.page.link/apple-app-site-association and https://yourapp.page.link/.well-known/apple-app-site-association.
The generated apple-app-site-association file looks something like:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1234567890.com.example.ios",
"paths": [
"NOT /_/*",
"/*"
]
}
]
}
}
and it is redirecting all paths to my app.
I want to exclude certain paths that should not be handled by my app. I know I can do this by specifying “NOT ” in front of the path that i want to exclude in the paths array, but I just can't find a way to edit the auto-generated file.

I had a similar issue with dynamic links "hijacking" the links for email verification and password reset, forcing me to manually add exclude paths to the apple-app-site-association file. The only way forward I could find that seems to be working is to do the following:
Add your apple-app-site-association file to your public folder:
/public/apple-app-site-association (or whatever you have set as public folder)
/public/.well-known/apple-app-site-association
Add the following to the hosting section in your firebase.json (keep "appAssociation": "AUTO" or your dynamic links will stop working and you'll see an error message in the console.)
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
},
{
"source": "/apple-app-site-association",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
}
]

Related

How to format and serve an apple-app-site-association file correctly

I'm trying to set up an apple-app-site-association file for several apps that share a common set of paths. There are two sets of documentation from Apple that conflict. Firstly, this doc says that each app should have its own section and then there is a paths element that contains mappings:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "9JA89QQLNQ.com.apple.wwdc",
"paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]
},
{
"appID": "ABCD1234.com.apple.wwdc",
"paths": [ "*" ]
}
]
}
}
Then there is this doc for XCode which shows a quite different format:
{
"applinks": {
"details": [
{
"appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
},
{
"/": "/buy/*",
"comment": "Matches any URL whose path starts with /buy/"
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
},
{
"/": "/help/*",
"?": { "articleNumber": "????" },
"comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
}
]
}
]
},
"webcredentials": {
"apps": [ "ABCDE12345.com.example.app" ]
},
"appclips": {
"apps": ["ABCED12345.com.example.MyApp.Clip"]
}
}
Neither document has any date or version information, so I can't tell which is more recent or correct.
The appIDs themselves are also confusing because there are apparently multiple sources of these identifiers, but not all of them will work, though I can't tell if that's my problem now.
I'm serving my document from /.well-known/apple-app-site-association, but I find a validator gives odd validation failures such as not being able to get the file (though fetching it with curl or a browser works fine), and a complaint that it can't be verified with openssl, which makes no sense because it contains nothing that's even vaguely related to certificates or signatures. Why does the document need to be delivered with a application/pkcs7-mime MIME type when it's neither MIME nor PKCS7 format?
Looking at Apple's own AASA, I see that it uses both of these formats! It also fails validation in all of the validators I tried, including Apple's own! This is very confusing.
How exactly should this document be formatted?

Apple App Site Association File Parsing Error

We're trying to get universal links working in our app but we are encountering errors when trying to download the Apple App Site Association file.
We've used various online tools to validate the file and they all say their is a parsing error but they don't go into any detail about what the issue is.
We've validated that the JSON is valid but what else could be wrong with the file contents?
{
"applinks": {
"details": [
{
"appIDs": [ "12345NGB.co.uk.my.app" ],
"components": [
{
"/": "/universallink/*",
"comment": "Matches any URL whose path starts with /universallink/"
}
]
}
]
}
}
It turns the I did need to follow the format outlined here: https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
{
"applinks": {
"apps": [],
"details": [{
"appID": "12345NGB.co.uk.my.app",
"paths": ["/universallink/*"]
}]
}
}
The Apple documentation is very misleading because it suggests that's an old format for supporting iOS 12 and earlier.

How to add paths to the apple-app-site-association file if a site has subpaths for determining locales?

I am having doubts regarding a particular scenario on adding paths to an association file.This is an association file for a site www.abc.com.Now the site starts to support localization ,For ex. www.abc.com/en-ca for Canada,it will display a localised Canadian site.In future more locales will be added.The rest of the paths mentioned in the association file are same (ex. www.abc.com/path1/* now becomes www.abc.com/en-ca/path1/*.How can the association file be modified in such a way that it supports www.abc.com/en-ca and many more locales in the future?
{
"applinks": {
"apps": [],
"details": [
{
"appID": "teamid.com.xxx.appName",
"paths": [
"/",
"/path1/*",
"/xx/xx/path2*",
"/path3",
"/path4/*",
"/path5*",
"/path6*"
]
}
]
},
"webcredentials": {
"apps": [
"teamid.com.xxx.appName"
]
}
}
As Documentation says you can use:
/photography/*/samples/201?/mypage
So in your example, it would be:
"paths": [
"/",
"/path1/*",
"/xx/xx/path2*",
"/path3",
"/path4/*",
"/path5*",
"/path6*"
"/*/",
"/*/path1/*",
"/*/xx/xx/path2*",
"/*/path3",
"/*/path4/*",
"/*/path5*",
"/*/path6*"
]

deeplinking iOS with dynamic url

I want to perform a deeplink to my iOS app to reset the app
my url goes https://something/en/reset-password?...
I made the needed apple-app-site-association
this works when i put in the path section
"paths": [
"*"
]
but when I change it to
"paths": [
"/(fr|en)/reset-password*"
]
the app doesn't open/ link to app is gone
Is there something wrong with the paths formatting?
Check your path section * .
Your file format should be like this.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "BundleIdentifierOfYourApp",
"paths": ["/reset-password/*"]
}
]
}
}
Even you can add more as per your need in the path section like.
["/reset-password/*","reset-password1/*","reset-password2/*"]

iOS Universal Links apple-app-site-association File Mix 2 Signatures For Same App

I have an app on the app store that use UniversalLinks I want to be able to test the functionality in development also.
Is it possible to have the apple-app-site-association file like so with both signatures?
{
"applinks": {
"apps": [ ],
"details": [
{
"appID": "XXXXXXXXXX.EP.myCompany.client",
"paths": [
"*", "/"
]
},
{
"appID": "XXXXXXXXXX.com.myCompany.client",
"paths": [
"*", "/"
]
}
]
}
}
Yes, you can.
Check out examples from others to see how AASA is formatted. Like https://facebook.com/apple-app-site-association or https://amazon.com/apple-app-site-association

Resources