Google signin returns 12500, 12501 error code

i am building android application and using google sign in using following code

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) 
                    //.requestIdToken("xxxxxxx-xxxxxxxxxx.apps.googleusercontent.com") 
                    .requestServerAuthCode("xxxxxxx-xxxxxxxxxx.apps.googleusercontent.com") 
                    .requestEmail() 
                    .build();


getting following status
{statusCode=unknown status code: 12501, resolution=null}


GOOGLE SIGNIN 12500 12501

Submitted by sunil On Friday, 11 December 2015.
Category: Javascript

[RESOLVED]

0
1 Answers.
 
Super User
crooker

Re:Google signin returns 12500, 12501 error code

in my case keystore's SHA-1 was not included in project on google developer console and google-services.json

How to get SHA-1:

on MAC
path/to/keystore ==
~/.android/debug.keystore


on Window
path/to/keystore ==
C:\Documents and Settings\[USER NAME]\.android\debug.keystore

keytool is in
C:\Program Files\Java\jdk1.7.0_79\bin
or whatever jdk version you have



Run the following command on terminal/command-prompt
keytool -list -v -keystore  path/to/keystore

above command will print something like this

Alias name: androiddebugkey 
Creation date: 10 Dec, 2015 
Entry type: PrivateKeyEntry 
Certificate chain length: 1 
Certificate[1]: 
Owner: xxxxx 
Issuer: xxxxx 
Serial number: xxxxx 
Valid from: Wed Dec 09 20:20:53 IST 2015 until: Sun Dec 02 20:20:53 IST 2040 
Certificate fingerprints: 
	 MD5:  XX:XX:XX:XX 
	 SHA1: 12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:AA:BB:CC:DD 
	 SHA256: XXXXXXXXXXXXXX 
	 Signature algorithm name: XXXXXX 
	 Version: 3


copy the SHA1: XXXXX value (only XX:XX:XX... value without "SHA1:") where Alias name == androiddebugkey

now go to https://console.developers.google.com/apis/credentials and open your sign in app and add a new Credentials -> OAuth Client ID

Select
Application type == "Android"

and put this XX:XX.. value into form and fill package name in form and save it

then add same SHA1 value into google-services.json as bellow

........ 
"oauth_client": [ 
        { 
          "client_id": "XXXXXXXXXX.apps.googleusercontent.com",// newly saved client id on console.developers.google.com 
          "client_type": 1, 
          "android_info": { 
            "package_name": "com.example.myapp", // your app's package name 
            "certificate_hash": "1234567890ABCDEF1234567890ABCDEFAABBCCDD" //XX:XX:XX value without :  
          } 
        }, 
..... 
] 
......
Submitted by Super User On Friday, 11 December 2015
1
This Answer has been Chosen as Best Answer
Question is marked as resolved.