小编Ari*_*rez的帖子

错误:此应用程序不允许使用Google id_token。Firebase工作后无法访问

我正在使用Google登录,然后使用signInWithCredential传递Google凭据在Firebase上进行身份验证。

我遵循了所有程序,一切正常!突然,它停止工作了。我去了以前的工作代码,它仍然失败。因此,似乎数据库配置发生了一些事情。

在Firebase DB中,我已经检查过:

  • 数据库已启动并正在运行。事实上,我可以在未登录时阅读(如我所定义的规则)
  • Google的登录方法仍处于启用状态
  • 我的应用仍在注册项目配置,包括其SHA1签名(用于调试和发行版)
  • 我已经确认从配置下载的google-services.json文件仍然与我的应用程序json文件匹配

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)
Run Code Online (Sandbox Code Playgroud)

(我将项目信息更改为XXXX)

Firebase配置可能会发生什么变化?请帮忙!

编辑:已解决,如下所述。您还需要在https://console.developers.google.com/apis/credentials上查看Google API控制台。

android google-authentication firebase firebase-authentication

5
推荐指数
2
解决办法
4650
查看次数