Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Firebase Google SIgnon bad request

Android Firebase Google signin through authorization error when google return token id. i have both cleint id as well as web sdk key saved on firebase. Even json file.

 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();
                        }
                        // ...
                    }
                });

Got this error

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)

Though google signIn went well there is something missing with firebase which m not able to figure out need help

Logs

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

                                                   }
like image 248
DjHacktorReborn Avatar asked Mar 12 '23 04:03

DjHacktorReborn


1 Answers

In the firebase console (Overview) Under Your mobile apps click the overflow button (three vertical dots) and goto Manage.

Once there goto your app and download the google-services.json

Add that to the root directory of your app and also to the /app folder.

This worked for me to fix this exact error. I assume I changed something at some point and needed a new one.

Hopefully this helps. Goodluck

like image 176
GuyA Avatar answered Apr 06 '23 13:04

GuyA