用于重置密码的 Firebase 动态链接:当前项目未配置

Firebase dynamic links to reset password : not configured for the current project

我正在使用 Cloud Functions 通过 admin sdk 生成密码重置-link。

我需要在我的网站而不是我的移动应用程序中处理 link 操作。

我的操作代码设置如下:

ActionCodeSettings codeSettings = ActionCodeSettings(
        url: "https://example.com/links/reset",
      handleCodeInApp: false,
      dynamicLinkDomain: "https://example.com/links"
    );

我也试过了:

ActionCodeSettings codeSettings = ActionCodeSettings(
        url: "https://example.com/links/reset",
      handleCodeInApp: false,
    );

两者都给我以下错误:

FirebaseAuthError: The provided dynamic link domain is not configured or authorized for the current project.

我只是在对我的函数的 onCall https 请求中使用 : admin.auth().generatePasswordResetLink(data.email, actionCodeSettings) 方法。

我当然为我的项目设置了动态 links,我的项目在 Firebase Hosting.

上运行良好

我也已将此添加到我的 firebase.json 文件中:

"rewrites": [ {
  "source": "/links/**", 
  "dynamicLinks": true
} ]

documentation 中所述。

我做错了什么?

如果我从 flutter 生成 ActionCodeSettings 它不起作用。

但是,如果在我的 NodeJS 代码中实现:

const actionCodeSettings = {
    url: "https://example.com/links",
    handleCodeInApp: false
  };

有效。

在日志中我可以看到参数 dynamicLinkDomain 被设置为 null 并通过了,即使我没有使用它。