112

I am usign gplus sign in, and getting this error at time I am in onActivityResult....

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
    client.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 0) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {

            GoogleSignInAccount acct = result.getSignInAccount();
//                Log.d("Result","details"+ acct.getDisplayName() + acct.getEmail());

            mEmail = acct.getEmail();
            String mFullName = acct.getDisplayName();
            String mGoogleplusId = acct.getId();


            SocialUser user = new SocialUser();
            user.setType("googleplus");

            user.setEmail(mEmail);
            user.setFullname(mFullName);
            user.setId(mGoogleplusId + "");
            loginParams.put("email_id", mEmail);
            loginParams.put("googlePlusId", mGoogleplusId);
            loginParams.put("full_name", mFullName);
            loginParams.put("registrationType", "googleplus");
            SignUpService(user);


        } else {
            Toast.makeText(CustomerLogIn.this, "Unable to fetch data, Proceed manually", Toast.LENGTH_SHORT).show();
        }
    }
}

And I am calling for gplus login on button click. On clcking button following code is executed....

 GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .build();
    mGoogleApiClient = new GoogleApiClient.Builder(CustomerLogIn.this)

            .addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
            .build();


    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, 0);

And I am geetng this error...

Status{statusCode=DEVELOPER_ERROR, resolution=null}

on this line....

GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);

Please suggest the solution.

Gurvinder Singh
  • 1,975
  • 3
  • 13
  • 20

22 Answers22

229

You need to add your SHA1 key to firebase console configuration. You can do it in this way:

Firebase console ( https://console.firebase.google.com ) -> your project -> configuration -> scroll to

enter image description here

You can find your SHA1 key running "Signing report" from Android Studio:

enter image description here

Then, look the "run tab" and click the button:

enter image description here

I think it's the easier way. Hope this help.

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
SolArabehety
  • 7,761
  • 5
  • 34
  • 39
  • 1
    here is the easiest way to get release SHA-1 from google developer console: https://stackoverflow.com/a/50124038/4923891 – Eren May 01 '18 at 21:26
  • I had problem to understand where to put that SHA key in Firebase Console. Finally found it. Open Project Settings > Scroll Down, Add Fingerprint, Put your SHA key there > Download new google-services.json and place it android-app\app – paakjis Aug 09 '18 at 10:52
  • 1
    Note! Even though firebase console has a space for SHA-256 key hash, you MUST enter the SHA-1 key. The SHA-256 will still give you errors – f.khantsis Feb 09 '19 at 23:21
  • Helpful. Thanks! – Pooja Mar 15 '20 at 05:53
32

Probably you created the configuration file using the SHA1 of your production token, use the androiddebugkey alias to gather the SHA1 corresponding to the debug version of your app and copy the configuration file to the 'app' directory, you should have both configuration files (one for debug purposes and another for production environment).

Based on the walkthrough published in https://developers.google.com/identity/sign-in/android/start

CopsOnRoad
  • 109,635
  • 30
  • 367
  • 257
Mario
  • 421
  • 3
  • 4
  • 6
    My error was fixed when I switched to the Web Client credentials instead of the Android Client for the OAuth 2.0 client ID's. The wording still confuses me as I am developing an Android app which talks to a web server... but the error is gone at least – Burrito Aug 13 '17 at 00:57
14

enter image description here

The way I fixed it was by picking up the key corresponding to the highlighted text. Due to the confusing usage of the word 'server' in Firebase's documentation page I was picking up the Server key . Which was the reason for the problem.

You can find the key here.

4127157
  • 1,457
  • 2
  • 14
  • 26
  • Thanks! Worked in my case. I think it somehow connected with using own backend server (and calling for "requestServerAuthCode" in GoogleSignIn) – ITurchenko Jun 21 '18 at 14:34
12

I had the same issue and I got it working by doing these steps:

1.Add DEBUG_KEYSTORE SHA1 fingerprint to the firebase project. use the following command(MAC/LINUX)

  keytool -exportcert -list -v \-alias androiddebugkey -keystore ~/.android/debug.keystore  

2.Now Generate a signed apk of your project. The process includes generating a keystore for your app's release version.

  Copy the path of the newly generated .jks file.

3.Now generate RELEASE_KEYSTORE SHA1 fingerprint using the following command

  keytool -list -v -keystore FULL_PATH_TOJKS_FILE -alias ALIAS_NAME

4.Copy the new SHA1 from the output and add it as another SHA1 fingerprint in your firebase application console.

Now you are good to go! ---- Hope! it helps.

Udit Kapahi
  • 2,149
  • 1
  • 24
  • 24
5

I was having the same problem, how I solved it is that I had different applicationId in my gradle file than the package name in my manifest file. And I used to applicationId to create the json file. I had to change my package name to what my applicationId was and that fixed it for me.

Renegade
  • 364
  • 6
  • 14
  • 1
    i always thought the package in the Manifest was overridden by the ApplicationId defined in gradle. That's not the case? – Flo We Nov 02 '16 at 08:47
4

You might have generated and added wrong SHA1 key. Use following steps to generate SHA1 key in Android studio:

  1. Click on Gradle (From Right Side Panel, you will see Gradle Bar)
  2. Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
  3. Click on Your Project (Your Project Name form List (root))
  4. Click on Tasks
  5. Click on Android
  6. Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console))

Now add this SHA1 key in your firebase android project.

Sanjay Sharma
  • 2,447
  • 2
  • 14
  • 31
3

Please Put correct json file in root of the android project
For more Refer here: https://coderzpassion.com/android-working-latest-google-plus-login-api/

Jagjit Singh
  • 1,711
  • 11
  • 17
3

Alternatively to the answers provided here, you can use Android Studio's Firebase Assistant to automatically add your SHA-1 to your project with the click of some buttons.

In Android Studio, go to Tools > Firebase > Select 'Authentication' and click the link that says 'Email and password authentication'.

This will bring you a little tutorial on how to integrate Authentication to your project, but since you've probably done all that, just click 'Connect to Firebase' and you're done.

3

It's an old question, but I have been stuck with error 10 (DEVELOPER_ERROR) lately, because I was using the Android client ID, I created in the google developer console.

The solution for me was to use the Android credentials in google developer console only to indicate the SHA key of my apk and to use the client ID of the Web application (!) credentials from the google developer console in my cordova application.

config.xml:

<plugin name="cordova-plugin-googleplus" spec="^5.3.0">
    <variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.[web-application-client-id]" />
    <variable name="WEB_APPLICATION_CLIENT_ID" value="[web-application-client-id].apps.googleusercontent.com" />
</plugin>

code:

window.plugins.googleplus.login(
    {
       'webClientId': '[web-application-client-id].apps.googleusercontent.com'
    }, 
    ...

I don't use firebase.

tobik
  • 1,129
  • 1
  • 8
  • 9
  • Thank you very much, it saved me a lot of time. Indeed using auto-generated web `client id` solved the DEVELOPER_ERROR issue. Although for me it doesn't make sense and it's not obvious that different client id should be used. – Myroslav Kolodii Jan 16 '20 at 13:45
1

The error is caused because the SHA-1 checksum of the debug or release key is not included in the firebase/google console.

First generate key using following command:

keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME

Then copy the SHA-1 checksum and go to:

Firebase Console > Your project > Settings of the app > Add Fingerprint

Nabin Bhandari
  • 13,991
  • 5
  • 38
  • 51
1

For me it was working when I first implemented it, but stopped after a few days of development, with the mentioned error message.

I've solved the issue with these steps:

  1. I have added the sha-256 fingerprint on top of the sha-1 fingerprint that I already had in the firebase console. (Not sure if this step is required)
  2. I have downloaded google-services.json file again and replaced the old file.
  3. re-installed the app

and it worked

Mantoska
  • 930
  • 8
  • 25
0

I came across this error in my firebase app. It was fixed when I added therequestIdToken(activity.getString(R.string.default_web_client_id)) part below.

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
        .requestEmail().requestIdToken(activity.getString(R.string.default_web_client_id))
        .build();

    apiClient = new GoogleApiClient.Builder(activity)
        .addConnectionCallbacks(this)
        .enableAutoManage(activity, this)
        .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
        .build();

    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(apiClient);
    activity.startActivityForResult(signInIntent, RC_GOOGLE_SIGN_IN);
Dan Brough
  • 2,267
  • 19
  • 23
  • what is default_web_client_id? from where I can get it? – Ayman Al-Absi Nov 05 '16 at 19:07
  • @AymanAl-Absi Have you setup your project properly for google services? see: https://developers.google.com/android/guides/google-services-plugin – Dan Brough Nov 05 '16 at 22:11
  • 1
    @AymanAl-Absi you also get the "default_web_client_id" from your google-service.json file in this file you can see Client_ID tag in that tag you copy only that text (client_ID) . – Prince Dholakiya Jul 11 '18 at 10:03
0

I got this error when i updated my json config file with a new google account.

Uninstalling the application manually and reinstalling the app worked for me.

sanath_p
  • 2,006
  • 2
  • 22
  • 22
0

For anyone releasing an app, you need a special fingerprint from your keystore file. No wonder why I was getting this error just for the release version. How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?

Juan Mendez
  • 2,242
  • 1
  • 22
  • 20
0

Ensure you enable Google Sign-In in under Authentication in the Firebase console.

hellowill89
  • 1,337
  • 2
  • 12
  • 24
0

I solved my problem by use right server_client_id in this line :

String serverClientId = getString(R.string.server_client_id);

I used the wrong code.

The MJ
  • 114
  • 1
  • 11
0

Some Services like google login require SHA1 fingerprint to be added to your firebase console.

I missed adding SHA fingerprint in firebase console. You can do so by going in FireBase Console > project setting > Add fingerprint option.

You can generate SHA1 Fingerprint by a very easy way https://www.youtube.com/watch?v=FczARQ244GE

After that I was doing one more mistake

After generationg SHA1 key fom above method. I copied the wrong invalid SHA1 key which was an expired one. So make sure the SHA1 key that you are copying from above way output is a valid one (Check the valid untill value as well of SHA1 Key)

Also make sure that the package name(x.y.z) that you have added in firebase is same as used in your android code.

Also make sure to use correct AppID

user2694064
  • 121
  • 1
  • 3
0

After long invistigation I have found a solution. Actually this error Error: Status{statusCode=DEVELOPER_ERROR, resolution=null} points to incorrect SHA-1 OR Incorrect package name OR something else?. In my case, I add debug keyword to end of my package name com.sample.app => com.sample.app.debug

Albert
  • 87
  • 7
0

I struggled with this issue because I made a copy of my application with changing the package name. I add a new project for it at Firebase. My mistake was that I forgot to change the server's client ID to the one in the new Firebase project.

more details under authintication with Firebase sectoin here

Amira Samawi
  • 111
  • 1
  • 3
0

When you let Google manage your app signing, you can find the SHA-1 key in the Google Play console. On the sidebar menu look for 'Configuration -> App integrity'. Here you will find the SHA-1 key for the signed app.

You also see the SHA-1 key for the signed app you've uploaded to the store.

Tijnos
  • 121
  • 2
  • 4
0

don't forget to add release finger print. the former answers tell just add debug finger print which your problem just solve when you run your app in debug mode. if you release your app you can see that your problem is still remain . then make sure you added release finger print too .

Dharman
  • 21,838
  • 18
  • 57
  • 107
Mosayeb Masoumi
  • 171
  • 1
  • 5
0

If you're running into this issue with a released version (production):

Go to the Google Play console and copy SHA-1 key from Release -> Setup -> App Integrity