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

Viewed 480

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.

1 Answers

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:

  1. 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
  2. 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