FirebaseAuth: getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@489

前端 未结 17 1867
孤街浪徒
孤街浪徒 2020-12-17 16:04

When I am trying to phone authntication I am getting below error.

W/BiChannelGoogleApi(12340): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.goo         


        
相关标签:
17条回答
  • 2020-12-17 16:35

    This might be due to an incompatible version of google play services on your testing device.

    If it is an emulator, try switching to another image and check if you are on the lastest version of play services.

    Note that only Android N (API 24) and above supports update of play services via playstore.

    0 讨论(0)
  • 2020-12-17 16:37

    I lost a few hours on this one, so let me share my experience on this.

    Gms stands for "Google Mobile Services", and its basically an addon API to Android developed by Google that allows to connect to a bunch of Google-provided services. If you use flutter, this is probably wrapped by flutter packages you use such as firebase_auth, flutter_facebook_login or/and google_sign_in.

    This error may sometimes be handled by the higher level components, so if you have that error, it doesn't mean your configuration is wrong or it won't work. In my case I had this error with successful end result when I was logging using Google Sign in, something like this:

    info flutter.tools W/BiChannelGoogleApi( 4106): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@8116b2c
    info flutter.tools D/FirebaseAuth( 4506): Notifying id token listeners about user ( lCZZZZJELWhGUZZZZB3vDklZZZZ2 ).
    info flutter.tools D/FirebaseAuth( 4506): Notifying auth state listeners about user ( lCZZZZJELWhGUZZZZB3vDklZZZZ2 ).
    info flutter.tools I/flutter ( 4506): FirebaseUser({uid: lCZZZZJELWhGUZZZZB3vDklZZZZ2, photoUrl: https://lh5.googleusercontent.com/-ZZzir_P-ENw/AAAAAAAAAAI/AAAAAAAAAAA/PpxhiXg_ISk/s96-c/photo.jpg, isAnonymous: false, etc....
    

    I have a dart call print(fireUser); in my code so we see it's a success.

    But in the case of Facebook Auth, I just had this, and nothing happened after that, but on the Facebook server side, login was succeeding as I could see events in Facebook dev console.

    info flutter.tools W/BiChannelGoogleApi( 4106): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@8116b2c
    

    And nothing else after in the log, so something was stuck in the process.

    My problem was I mixed two applications App Id and Secret. I'm a bonehead sometimes, but the thing is there's zero warning or specific error nowhere, so here are a list of things that can fail with Firebase and other plugins:

    • Make sure you have properly configured the sign-in provider (google, facebook, etc.) in Firebase console
    • Upgrade all flutter packages. I personnaly don't use package versions, I use all flutter packages latest version. And I use AndroidX.

    In the specific case of Facebook Auth (I find Google Sign In much easier to integrate):

    • make sure your looking at the good app
    • make sure the App ID and App secret are the good one. In Facebook dev console, check the Basic Settings there.
    • make sure you have added the "Facebook Login" product. If you don't see it in the left menu, in Facebook dev console, check the Dashboard and add it.
    • in the "Facebook Login" product settings, make sure you have added the "Valid OAuth Redirect URIs" that Firebase console gives you (in the Facebook Sign-in provider config). You can check it in the "Redirect URI validator" tool lower in that page.
    • in the Basic Settings of the app, if you use flutter (=> mobile platforms), make sure you have an IOS section/platform and and Android section/platform. To achive that you can do it manually "Add platform", or use the Quick Starts.
    • in the end, the IOS section can contain only the "Bundle ID"
    • and the Android section should containe the "Google Play Package Name", the "Class Name" and at least one "Key Hashes" (for debug). If you don't know how to create the hash, use the "Facebook Login" quick start.

    Hope this helps

    0 讨论(0)
  • 2020-12-17 16:38

    I had this error and i couldn't connect with email/password after updating my libraries in my pubspec.yaml file.

    To resolve this error, I also updated my gradle file (build.grade) :

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
    }
    

    and my gradle-wrapper.properties file, I updated the following line :

    distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
    
    0 讨论(0)
  • 2020-12-17 16:38
    W/BiChannelGoogleApi(12340): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@489
    

    These types of error codes are pretty much useless. Try

    Log.i("flag", "signInAnonymously:failure", task.exception) 
    

    inside the auth.createUserWithEmailAndPassword or similar method.

    When authenticating google will look for a password with at least more than 6 characters.

    You can see some examples here: https://github.com/firebase/quickstart-android/tree/master/auth

    0 讨论(0)
  • 2020-12-17 16:39

    If you are going with the phone authentication, please check whether you are providing the country code or not. That worked for me.

    0 讨论(0)
  • 2020-12-17 16:40

    This is a dependency issue, you may want to review your firebase setup again. I ran through a flutter app, and had the same exact issue.

    0 讨论(0)
提交回复
热议问题