1
votes

I have setup Firebase Dynamic Links with an URL in the following format: a.b.c/d

However, emails sent by Firebase Authentication contain Dynamic Links of the format a.b.c/?link=... instead of a.b.c/d/?link=..., which means that they do not work.

I followed this guide / this guide to send the links.

Whenever I manually copy the link and add d/ in the URL, the Dynamic Links will work since Dynamic Links is set up this way in Firebase Console and also in firebase.json for Firebase Hosting.

"appAssociation": "AUTO",
"rewrites": [
  {
    "source": "/d/**",
    "dynamicLinks": true
  }
]
1
Firebase Auth does not support custom paths in dynamic links. This features was recently added to dynamic links and is not yet supported. - bojeil
@bojeil So what should I do? The links simply do not work because of the wrong URL. And using just a.b.c would disable the underlying web site. - creativecreatorormaybenot
Unfortunately, you don't have a lot of choices. You will need to create a new custom domain. - bojeil

1 Answers

0
votes

Unfortunately, Firebase Authentication does not yet support custom paths in Dynamic Links as bojeil pointed out (confirmed by Firebase support).
Unfortunately, capturing URL segments in Firebase Hosting redirects does not support query parameters, which would be required to redirect /?link=... to /d/?link=....

Because of these two unfortunate circumstances, I simply used some JavaScript to redirect any request to /?link=... to /d/?link...:

const link = new URLSearchParams(window.location.search).get('link')
if (window.location.pathname == '/' && link != null && link != '') window.location = `a.b.c/d/${window.location.search}`