我正在使用Google登录,然后使用signInWithCredential
在Firebase上进行身份验证,并传递Google凭据。
我遵循了所有程序,一切正常!突然,它停止工作了。我去了以前的工作代码,它仍然失败。因此,似乎数据库配置发生了问题。
在Firebase数据库中,我已经检查过:
在Google登录完成后,错误消息如下,因为我是通过在监听器中使用task.getException从try-catch获得的:
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)
[Firebase配置中还有哪些其他更改?请帮助!
编辑:已解决,如下所述。您还需要在https://console.developers.google.com/apis/credentials
上查看Google API控制台诸如您的登录方法之类的声音已更改。您需要进入Firebase身份验证页面,并确保仍然允许Google登录。
转到Firebase控制台->身份验证->登录方法并在登录提供商中确保已启用Google。
也可以:
获取您的Web客户端ID并记下客户端ID和密码。
将此客户端ID输入到Firebase项目的配置中:
转到https://console.firebase.google.com的Firebase控制台打开身份验证部分在“登录方法”下,打开Google配置,然后在“ Web SDK配置”部分下添加值。