错误:此应用程序不允许使用Google id_token. Firebase访问在工作后失败 [英] Error: Google id_token is not allowed to be used with this application. Firebase access fails after it was working
问题描述
我正在使用Google登录,然后使用signInWithCredential
在Firebase上进行身份验证,并传递Google凭据.
I'm using Google SignIn and then authenticate on Firebase using signInWithCredential
, passing the Google credentials.
我遵循了所有程序,一切正常!突然,它停止工作了.我转到了以前的工作代码,但仍然失败.因此,似乎数据库配置发生了什么.
I followed all the procedures, and everything was working! And suddenly it stops working. I went to a previous working code and it still fails. So it seems something happened with the database configuration.
在Firebase数据库中,我已经检查了:
In Firebase DB I already checked:
- 数据库已启动并正在运行.事实上,我可以在未登录时阅读(如我所定义的规则)
- 仍然可以启用Google的登录方法
- 我的应用仍在注册项目配置,包括其SHA1签名(用于调试和发行版)
- 我已确认从配置下载的google-services.json文件仍与我的应用程序json文件匹配
在Google登录完成之后,错误消息如下,因为我是通过在侦听器中使用task.getException从try-catch获得的:
After Google login finish Ok, the error message is as follows as I get from my try-catch with task.getException in the listener:
com.google.firebase.FirebaseException: An internal error has occurred. [ Invalid Idp Response: the Google id_token is not allowed to be used with this application. Its audience (OAuth 2.0 client ID) is XXXXX-XXXXX.apps.googleusercontent.com, which is not authorized to be used in the project with project_number: XXXXX. ]
at com.google.android.gms.internal.zzago.zzew(Unknown Source)
at com.google.android.gms.internal.zzagl$zzg.zza(Unknown Source)
at com.google.android.gms.internal.zzagw.zzex(Unknown Source)
at com.google.android.gms.internal.zzagw$zza.onFailure(Unknown Source)
at com.google.android.gms.internal.zzagr$zza.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:453)
(我将项目信息更改为XXXX)
(I changed my project info to XXXX)
Firebase配置可能发生了哪些其他变化?请帮忙!
What else could have changed in the Firebase configuration? Please help!
已解决,如下所述.您还需要在 https://console.developers.google上查看Google API控制台. com/apis/credentials
SOLVED, as described below. You need to also take a look at the Google API console at https://console.developers.google.com/apis/credentials
推荐答案
- 您必须在此处 https://console.developers.google.com创建Web客户端Oauth 2.0 ID https://console.developers.google.com .之后,您将拥有客户端ID和密码
- 打开 https://console.firebase.google.com 并转到身份验证->登录方法-> Google-> Web SDK配置,并使用您在第1步中获得的客户端ID和密码. Web客户端机密.
- You have to create Web-client Oauth 2.0 id here https://console.developers.google.com . After that you will have client id and secret
- Open https://console.firebase.google.com and goto Authentication -> Sign-in method -> Google -> Web SDK configuration and use client id and secret you have got on the step 1. in Web client ID & Web client secret.
这篇关于错误:此应用程序不允许使用Google id_token. Firebase访问在工作后失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!