我正在Angular 4项目中使用Firebase Auth(firebase 4.1.3),启用了Google登录。在本地主机上工作时,一切都按预期运行。但是,在Google App Engine上部署我的应用时,验证弹出窗口失败,并显示“auth/unauthorized-domain”错误。
如何在Firebase中将我的自定义域列入白名单?
已完成的检查:
1.我的firebase项目已启用并激活计费
1.在localhost上使用弹出窗口进行Google登录
- Google应用程序引擎域已在Firebase控制台的Authenticacion模块中的登录方法下的“授权域”中列入白名单。
1.仔细检查了我的Angular 应用程序中的javascript firebase配置(我复制粘贴了firebase控制台提供的代码片段)。
1.在Google云控制台中,默认Web API密钥没有访问限制,OAuth客户端ID已在“授权JavaScript源”列表和“授权重定向URI”(https://console.developers.google.com/apis/credentials?project=MYPROJECT)中包含我的App Engine域。
其他一些类似的SO问题涉及到检查以前的事情,甚至等待长达20分钟后,白名单一个新的域,以允许更改传播。
注意:完整的错误代码
{
code: "auth/unauthorized-domain"
message: "This domain (PROJECT.appspot.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."
}
任何帮助都将不胜感激。
3条答案
按热度按时间7kqas0il1#
好吧,回答我自己的问题。我终于找到问题了:我正在部署一个旧版本的网络应用程序。所以它永远不会这样工作...
如果它可能对其他人有用,以上配置firebase Auth的步骤是正确的,足够了!
bz4sfanl2#
我接管了一个现有的项目,在使用错误的环境进行部署时出现了此错误。(在Firebase中正确设置了域)
ng build --configuration "${ENV}" && firebase deploy
在我的开发环境上部署时。
我编写了部署脚本以避免此类错误。
ng build --configuration "${ENV}" && firebase deploy
个其中env var设置为脚本的参数
rwqw0loc3#
我遇到过同样的问题。然后我找到了解决办法。首先后藤你的**
firebase project
然后点击Authentication
转到sign-in method
然后向下滚动,你会发现Authorized domains
**在那里添加你的实时网站链接。Hurrey问题解决了。Authentication > sign-in medhod > Authorized domains
firebase solution image个月