Firebase 身份验证/未经授权的域。域名未授权

问题描述 投票:0回答:10

我正在尝试运行这个 sample firebase 项目,但我不断在浏览器控制台中收到此错误。

Lf {code: "auth/unauthorized-domain", message: "This domain (mail-demo-fcm.firebaseapp.com) is not…se console -> Auth section -> Sign in method tab."}

code: "auth/unauthorized-domain"

message: "This domain (mail-demo-fcm.firebaseapp.com) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab."

我已在身份验证 -> 登录方法中启用 Google 作为登录提供商。

我错过了什么吗?

一些指南会有帮助。

我正在使用 Firebase 的免费计划。

firebase firebase-authentication google-cloud-functions
10个回答
158
投票

您需要添加域名

mail-demo-fcm.firebaseapp.com
到 Firebase 中授权域的身份验证菜单


12
投票

授权域部分也可能位于设置页面中。这是一个屏幕截图:


11
投票

如果 localhost 已在域列表中,请确保您通过 http://localhost/ 访问测试应用程序,而不是 http://127.0.0.1/


7
投票

登录方法部分下方有一个授权域部分。我认为您需要将您的域名列入白名单。


3
投票
  1. 打开 Firebase
  2. 转到控制台
  3. 打开您的项目
  4. 前往身份验证
  5. 登录方法
  6. 添加域名

尝试一下!

就我而言,它正在工作


1
投票

启用 localhost 和您在 firebase 控制台中使用的您自己的域。

  1. 登录 Firebase
  2. 单击身份验证选项卡
  3. 添加授权域

0
投票

@alkas 的解决方案很有帮助,但我还需要显式启用我的应用程序的登录提供程序(电子邮件/密码、Google 等)才能消除此错误


0
投票

就我而言,我在从“授权域”中删除 localhost 后发现了问题。

所以我只是添加它(本地主机),所以一切都好!

-localhost,因为我在本地,

部署应用程序时的

-project_name.firebase.com 和project_name.web.app。 谢谢!


0
投票

就我而言,我使用两种环境进行开发和测试。我错误地将构建部署到了使用开发配置参数创建的测试环境。


0
投票

只需转到:身份验证 -> 设置 -> 授权 -> 添加:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.