Dynamic Links Custom Path not applied in Firebase Authentication

旧城冷巷雨未停 提交于 2019-12-13 01:45:54

问题


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:


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}`


来源:https://stackoverflow.com/questions/55489824/dynamic-links-custom-path-not-applied-in-firebase-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!