Android Firebase Google SIgnon请求不好

DjH*_*orn 4 android google-authentication firebase firebase-authentication

Android Firebase Google在google返回令牌ID时签署授权错误.我有两个cleint id以及在firebase上保存的web sdk密钥.甚至json文件.

 AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                        // If sign in fails, display a message to the user. If sign in succeeds
                        // the auth state listener will be notified and logic to handle the
                        // signed in user can be handled in the listener.
                        if (!task.isSuccessful()) {
                            Log.w(TAG, "signInWithCredential", task.getException());
                            Toast.makeText(OnBoarding.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }
                        // ...
                    }
                });
Run Code Online (Sandbox Code Playgroud)

得到了这个错误

com.google.firebase.FirebaseException: An internal error has occured. [ Bad Request ]
                                                                          at com.google.android.gms.internal.zzacq.zzbN(Unknown Source)
                                                                          at com.google.android.gms.internal.zzacn$zzg.zza(Unknown Source)
                                                                          at com.google.android.gms.internal.zzacy.zzbO(Unknown Source)
                                                                          at com.google.android.gms.internal.zzacy$zza.onFailure(Unknown Source)
                                                                          at com.google.android.gms.internal.zzact$zza.onTransact(Unknown Source)
                                                                          at android.os.Binder.execTransact(Binder.java:565)
Run Code Online (Sandbox Code Playgroud)

虽然google signIn运行良好但firebase缺少一些东西,但是我们无法找到需要帮助的东西

日志

"error": {
    "errors": [{
        "domain": "usageLimits",
        "reason": "keyExpired",
        "message": "Bad Request"
    }],
    "code": 400,
    "message": "Bad Request"
}

                                                   }
Run Code Online (Sandbox Code Playgroud)

小智 7

在firebase控制台(概述)下,在您的移动应用程序下,单击溢出按钮(三个垂直点)并转到管理.

一旦转到您的应用程序并下载google-services.json

将其添加到应用程序的根目录,也添加到/ app文件夹.

这对我有用,可以解决这个确切的错误.我假设我在某些时候改变了一些东西,需要一个新的东西.

希望这会有所帮助.祝好运