BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq

UPDATED: 27 June 2020
Firebase + Google
BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq
One weird exception where Google doesn't show whats wrong with our code or process. I faced same exception and I scratched my head all day long to fix this issue and finally I fixed it. I'm using phone based Authentication of Firebase.

Step 1: Enable Firebase logging to see behind whats happening behind the scene. Add following code in your Main activity class where you are performing authentication.
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
firebaseDatabase.setLogLevel(Logger.Level.DEBUG);
  
Step 2: Now you will get the actual error why its not working. In my case I got following exception.
com.example W/System.err: com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
com.example W/System.err:     at com.google.firebase.auth.api.internal.zzeh.zza(com.google.firebase:firebase-auth@@19.3.1:37)
com.example W/System.err:     at com.google.firebase.auth.api.internal.zzfj.zza(com.google.firebase:firebase-auth@@19.3.1:3)
com.example W/System.err:     at com.google.firebase.auth.api.internal.zzfm.run(com.google.firebase:firebase-auth@@19.3.1:4)
com.example W/System.err:     at android.os.Handler.handleCallback(Handler.java:883)
com.example W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:100)
com.example W/System.err:     at android.os.Looper.loop(Looper.java:214)
com.example W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7682)
com.example W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
com.example W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
com.example W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
com.example E/"TAG": onComplete: Failed=This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
  
Step 3: I synced Firebase configuration in Android Studio again by Tools > Firebase > Authentication > Connect > Sync

That's it my exception is no longer there. 

0 comments :