google-services icon indicating copy to clipboard operation
google-services copied to clipboard

Google SignIn Fails with code 10 (on Android)

Open sudarsangp opened this issue 8 years ago • 70 comments

Step 1: Describe your environment

  • Device: Xiaomi Redmi Note 3
  • OS version: 6.0.1
  • MIUI version MIUI Global 9.2

Step 2: Describe the problem:

Throws Error after choosing Google account

com.google.samples.quickstart.signin W/SignInActivity: signInResult:failed code=10

Steps to reproduce:

  1. Clone the repository and Launch SignIn App (under Android)
  2. Click SignInActivity
  3. Click Google Sign In button
  4. Choose your Google Account
  5. Logs above error in Logcat

sudarsangp avatar Apr 14 '18 07:04 sudarsangp

I have also been getting the same error response for the past few days; I have been trying to fixed the problem but no breakthrough and I learnt that the response code (10) means it is a developer problem. I hope someone can profer a solution here.

ibnahmadbello avatar Apr 14 '18 16:04 ibnahmadbello

Same issue.

makeze avatar Apr 16 '18 12:04 makeze

Hi all. Error code 10 is DEVELOPER_ERROR: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes.html#DEVELOPER_ERROR

This almost certainly means you have not properly registered your SHA1 and Package Name in the Google API console: https://developers.google.com/identity/sign-in/android/start

If you are 100% sure that you have done this correctly, make sure that your GoogleSignInOptions are correct. In particular, make sure the web client ID (if you're using it) belongs to the same project where you registered your package name and SHA1.

I am going to close this issue since that's the best advice I can provide with the limited information above.

samtstern avatar Apr 16 '18 15:04 samtstern

I just cross-check my SHA1 and discovered a mistake. I have fixed it and the Google sign-in is working as expected. My initial SHA1 was gotten via the terminal while I got the present one via Android studio. Maybe @makeze and @sudarsangp can try something like that if it works. @samtstern thanks for the tip.

ibnahmadbello avatar Apr 16 '18 21:04 ibnahmadbello

@samtstern sorry for the trouble it was indeed a misconfiguration issue. @ibnahmadbello thanks for the suggestion.

I still have a question though. I am trying out SignInActivity and I don't see any usage of server_client_id in SignInActivity.java. Does Google Identity service check whether the project (in google cloud) has a valid OAuth 2.0 client ID with the same package name (as the app) in order to allow Signing In?

sudarsangp avatar Apr 17 '18 00:04 sudarsangp

@sudarsangp the web server client ID is used to mint the ID token, so that it's signed for the right "audience". It's actually not required for signing in, but we recommend that after you sign in you use the ID token to authenticate to your server or to another service (like Firebase Auth) if you need to (rather than an access token, which is dangerous)

samtstern avatar Apr 17 '18 01:04 samtstern

I am new to android development and had opted in for google play app signing. My debug release worked fine but when publishing to internal test release it would fail. I realized the app is being resigned upon uploading to google so I registered using signing keys from google play portal and that fixed it. Oddly enough, examining the gradle signing report would only show sha1 for debug builds and not for release builds no matter I had selected the release keystore. Thankfully for now it is not an issue using google play signing.

randallto avatar Jun 27 '18 20:06 randallto

Google is getting more and more ugly, they're making simple things complicated. The problem is the third key,

1、the debug key

2、the release key

3、Google Play App signing key

You need THREE keys to figure out ONE Google SignIn.

Does facebook also need three keys? Maybe one day google will need 30 keys.

ghost avatar Jul 12 '18 23:07 ghost

@mike1128 yeah, Facebook too requires 3 keys if you've signed up for Google Play App signing. Refer to this article.

akashdmahali avatar Aug 18 '18 18:08 akashdmahali

thanks @samtstern

erlangparasu avatar Mar 11 '19 06:03 erlangparasu

I just cross-check my SHA1 and discovered a mistake. I have fixed it and the Google sign-in is working as expected. My initial SHA1 was gotten via the terminal while I got the present one via Android studio. Maybe @makeze and @sudarsangp can try something like that if it works. @samtstern thanks for the tip.

It works for me, thanks ;)

milogus avatar Aug 09 '19 18:08 milogus

hi @ibnahmadbello I had the same problem when I was using sh1 generated from the commande line. but when I used android studio I get an other key and it work. thank you

rady-ben avatar Aug 12 '19 00:08 rady-ben

Hello @rady-ben , what is your way to get sha1 from android studio?

antranvn avatar Aug 18 '19 09:08 antranvn

优秀

ripple666 avatar Aug 23 '19 13:08 ripple666

This error might happen if you are not using same project at console.developers.google and console.firebase.google.com. If project is same at both console make sure you have add your SHA1 Key properly. Get SHA1 from Android studio.

Open Android Studio Open your Project Click on Gradle (From Right Side Panel, you will see Gradle Bar) Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project) Click on Your Project (Your Project Name form List (root)) Click on Tasks Click on Android Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console)) Select app module from module selection dropdown to run or debug your application 
 You also need to get google-services.json from firebase console and put into your project.

technologyshare avatar Sep 15 '19 06:09 technologyshare

@technologyshare there is no Gradle Bar. How to turn it on?

deadsoul44 avatar Sep 15 '19 07:09 deadsoul44

@technologyshare: do we need to submit Oauth screen?

antranvn avatar Sep 15 '19 08:09 antranvn

@technologyshare there is no Gradle Bar. How to turn it on?

image Check in the right side

technologyshare avatar Sep 15 '19 12:09 technologyshare

@technologyshare: do we need to submit Oauth scre

@technologyshare: do we need to submit Oauth screen?

if you are integrating it from web than you need to pass oauth screen, if you are doing only by phone. No Need

technologyshare avatar Sep 15 '19 13:09 technologyshare

When i release my app to playstore in beta mode the same server_client_ID doesn't works and i get error in:

    Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);

ApiException: 10

raunak-many-ac avatar Nov 06 '19 18:11 raunak-many-ac