com.google.android.gms.common.api.ApiException: 16:

前端 未结 6 1905
醉梦人生
醉梦人生 2021-02-09 07:37

I try to learn how i can use google sign in in my android App, but i catch com.google.android.gms.common.api.ApiException: 16 And i can\'t find on stackoveflow

相关标签:
6条回答
  • 2021-02-09 08:00

    I am developing an Android application using Flutter, tried to integrate Google Sign In and faced the same problem with ApiException: 16 and SIGN_IN_FAILED (instead of RESULT_CANCELED).

    Application type on Firebase was set to android.

    In my case, after many hours of debugging, it turned out to be a wrong SHA-1 problem.

    As soon as I extracted the SHA-1 key from my project and updated Firebase console, it worked.

    0 讨论(0)
  • 2021-02-09 08:01

    Maybe a bit late to the party here but after more than 4 hours debugging I realized that:

    1.- Add an Android client with your signing-certificates fingerprints under the OAuth client IDs list. This is mandatory.

    2.- Add the Web application client ID in your code in case your need to get an id token

    // ID and basic profile are included in DEFAULT_SIGN_IN
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                                .requestIdToken("YOUR_CLIENT_ID")
                                .requestEmail()
                                .build();
    

    Hope it helps

    0 讨论(0)
  • 2021-02-09 08:04

    I had the same problem, start activity result kept coming back with RESULT_CANCELED and errorCode 16. The problem was my client configuration in Google Cloud Platform Console. I was using the regular debug and release api key. The result came back OK when I used web application as my Google Console configuration.

    Hope it helps.

    0 讨论(0)
  • 2021-02-09 08:09

    For me the only thing that worked was to provide 2 oauth client ids. a web application client id AND an android client id

    In my android app i use the client id and client secret of the web application. Even though i don't use the android client id anywhere in my app it is still required. ie if i delete the oauth android client in the google api console my app stops working EVEN THOUGH i dont use that client id ANYWHERE in my app.

    this makes absolutely no sense to me! go figure . but so far this is the only thing that has worked.

    un-freaking-believable.

    0 讨论(0)
  • 2021-02-09 08:09

    I used a different oauth id key which i found from downloading the project settings and added the client 3 key in the project.

    0 讨论(0)
  • 2021-02-09 08:13

    Was having the same problem, turns out I did not set support mail on firebase project settings.

    If this is the case, firebase will show you edit project settings when trying to enable Google sign in on Firebase Authentication. You can copy your client Id from firebase

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