[英]Firebase Google authentication forbidden (permission denied)
i am currently using firebase to trying authenticate users with google.我目前正在使用 firebase 尝试使用谷歌验证用户身份。 I set up an angular project with my project1.
我用我的项目 1 建立了一个 angular 项目。 While signing in anonymously into firebase, everything works as expected, if i change to signing in with google using the popup, it just breaks with the following error:
匿名登录到 firebase 时,一切都按预期工作,如果我更改为使用弹出窗口登录谷歌,它只会因以下错误而中断:
{
"error": {
"code": 403,
"message": "Requests from referer https://project1.firebaseapp.com/__/auth/iframe?apiKey=SECRET&appName=%5BDEFAULT%5D&v=7.13.2&usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.TVMmU0ureXg.O%2Fam%3DwQE%2Fd%3D1%2Fct%3Dzgms%2Frs%3DAGLTcCNEZ47O4XPxvOHlE2OsKBWeCQxiEw%2Fm%3D__features__ are blocked.",
"errors": [
{
"message": "Requests from referer https://project1.firebaseapp.com/__/auth/iframe?apiKey=SECRET&appName=%5BDEFAULT%5D&v=7.13.2&usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.TVMmU0ureXg.O%2Fam%3DwQE%2Fd%3D1%2Fct%3Dzgms%2Frs%3DAGLTcCNEZ47O4XPxvOHlE2OsKBWeCQxiEw%2Fm%3D__features__ are blocked.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
If i change my firebaseConfig from project1 to project2 (options like Google auth enabled, etc. are the same) it works properly.如果我将 firebaseConfig 从 project1 更改为 project2(启用 Google 身份验证等选项相同),它会正常工作。 Hence it can't be a client-issue.
因此,这不可能是客户问题。 Same error occurs by running locally and hosting by firebase.
在本地运行并由 firebase 托管会发生同样的错误。
I have absolutely no clue why is that, i am sure there has to be something obvious in the firebase settings which i just can't figure out yet.我完全不知道为什么会这样,我确信在 firebase 设置中一定有一些我无法弄清楚的明显的东西。 As far as i can tell, i changed all kinds of options on the firebase-platform itself.
据我所知,我更改了 firebase 平台本身的各种选项。
To answer my own question: Go to google cloud console -> Credentials -> OAuth 2.0 Client IDs -> Select your project and add a 'Authorised redirect URI':回答我自己的问题:Go 到谷歌云控制台-> 凭据 -> OAuth 2.0 客户端 ID -> Select 你的项目并添加“授权重定向 URI”:
' https://myproject.web.app/ /auth/handler ' or ' https://myproject.firebaseapp.com/ /auth/handler ' ' https://myproject.web.app/ /auth/handler ' 或 ' https://myproject.firebaseapp.com/ /auth/handler '
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.