默认情况下,Firebase 动态链接始终使用第一个域 URL 前缀来发送身份验证电子邮件

Jig*_*dya 6 android firebase firebase-authentication firebase-dynamic-links

我已经在我的 Android 应用程序中集成了 firebase 身份验证和电子邮件。我在动态链接部分有两个域 URL 前缀。默认情况下,Firebase 始终发送带有第一个域 url 前缀的链接。我尝试通过这种方法在代码中设置域 url 前缀 -

  actionCodeSettings.setDynamicLinkDomain(getString(R.string.dynamic_link_url))
Run Code Online (Sandbox Code Playgroud)

但它给出错误提供的动态链接域未配置或授权当前项目请建议实现此目的的正确方法。提前致谢。

Fad*_*lam 1

如果您添加了与第一个不同的新 URL 前缀,则需要手动更新Firebase 托管版本历史记录

你可以使用firebase CLI来完成

  1. 确保 firebase cli 已安装

  2. firebase 登录并选择您的项目

  3. 运行firebase init 确保在项目初始化期间,根据 Firebase CLI 提示:选择设置托管和函数 托管:为 Firebase 托管配置文件并(可选)设置 GitHub Action 部署

  4. 继续使用默认选项

设置完成后,它将生成包含index.html 404.html、.firebaserc 和 firebase.json 的公共文件夹

然后修改 firebase.json 并添加以下内容

{
"hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "appAssociation": "AUTO",
    "rewrites": [ { "source": "/links/**", "dynamicLinks": true }, { "source": "/share/**", "dynamicLinks": true } ]
  }
}
enter code here
Run Code Online (Sandbox Code Playgroud)
  1. 火力基地部署

请注意,链接和共享是我们的 2 个前缀,您可以将名称更改为您想要的任何名称,并请注意此前缀也可以由不同的子域使用