Google sign-in Android with Firebase - statusCode DEVELOPER_ERROR

23,615

Solution 1

DEVELOPER_ERROR means Google Play services was unable to find a matching client from the console based on your SHA1 and package name. You can add SHA1s in the settings page on the Firebase console for a given package name, or add a new package name through the Add Firebase to your Android app button.

In general, some things to check for:

  • Make sure your package name is what you expect - e.g. its the one in your build.gradle, and its not being overriden in a build variant or product flavor.
  • Make sure you have registered your debug and release SHA1 keys in the console.

Solution 2

If Google Play App Signing is enabled for your app, then it will replace your release signing key with the one on Google's server before publishing.

You can check if it is enabled from: Google Play Console -> Release Management -> App Signing.

In my case, to resolve the error I had to:

  1. copy the SHA1 from the 'App signing certificate' section
  2. add it to the Firebase projects general settings section
  3. regenerate the json file
  4. add it to the project
  5. re-upload the apk

Solution 3

Error code 10 is constant value of CommonStatusCodes.DEVELOPER_ERROR which implies you have misconfigured your project

What you can do

  • check if SHA from PlayStore Console and Firebase Console are same.

    Copy SHA from Google Play console

    enter image description here

paste it into Firebase Console

enter image description here

What else you can do?

Display meaningful messages in plain English case of failure

          // Google Sign In failed, update UI appropriately
            Log.w(TAG, "Google sign in failed", e);

            String messageToDisplay = "Authentication failed.";
            switch (e.getStatusCode()) {
                case CommonStatusCodes.API_NOT_CONNECTED: //17
                    messageToDisplay += "The client attempted to call a method from an API that failed to connect.";
                    break;

                case CommonStatusCodes.DEVELOPER_ERROR: //10
                    messageToDisplay += "The application is misconfigured.";
                    break;

                case CommonStatusCodes.ERROR: //13
                    messageToDisplay += "The operation failed with no more detailed information.";
                    break;

                case CommonStatusCodes.INTERNAL_ERROR: //8
                    messageToDisplay += "An internal error occurred.";
                    break;

                case CommonStatusCodes.INVALID_ACCOUNT: //8
                    messageToDisplay += "Invalid account name specified.";
                    break;

                case CommonStatusCodes.SIGN_IN_REQUIRED: //8
                    messageToDisplay += "Please Sign In to continue.";
                    break;
            }

            Toast.makeText(LoginActivity.this, messageToDisplay,
                    Toast.LENGTH_SHORT).show();

Solution 4

I had the same problem. What happens is this you have a SHA1 debug and release SHA1. Normally we used only SHA1 Debug and generate the .apk signed to google play, but when we use google sigin you must enter the firebase release of SHA1.

To view the release SHA1 use the following command:

 keytool -list -v -keystore C:\ProjectsData\keystore\my-release-key.keystore -alias alias_name 

Then enter this SHA1 on the Firebase

https://support.google.com/firebase/answer/7000104

This answer SHA1:

SHA-1 fingerprint of keystore certificate

Hope I helped you.

Solution 5

Had the same issue. But worked fine after I cleaned and rebuilt the project. :D

Share:
23,615
user5866501
Author by

user5866501

Updated on March 30, 2021

Comments

  • user5866501
    user5866501 about 3 years

    I try to implement Google login in my Firebase connected Android app. When I run the app and press Google Sign In button - nothing happen. And I receive this error in onActivityResult: Status{statusCode=DEVELOPER_ERROR, resolution=null}.

    My code looks like this:

         protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    
        if (requestCode == REQUEST_CODE_GOOGLE_LOGIN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
    
            if (result.isSuccess()){
                GoogleSignInAccount account = result.getSignInAccount();
                String emailAddres = account.getEmail();
                getGoogleQAuthToken(emailAddres);
            }
        }
    }
    
             private void getGoogleQAuthToken(final String emailAddres){
                 AsyncTask<Void,Void,String> task = new AsyncTask<Void, Void, String>() {
                     String errorMessage = null;
    
                     @Override
                     protected String doInBackground(Void... params) {
                         String token = null;
                         try {
                             String scope = "oauth2:profile email";
                             token = GoogleAuthUtil.getToken(MainActivity.this, emailAddres, scope);
                         } catch (IOException transientEx) {
    
                             errorMessage = "Network error: " + transientEx.getMessage();
                         } catch (UserRecoverableAuthException e) {
                             Intent recover = e.getIntent();
                             startActivityForResult(recover, MainActivity.REQUEST_CODE_GOOGLE_LOGIN);
                         } catch (GoogleAuthException authEx) {
                             errorMessage = "Error authenticating with Google: " + authEx.getMessage();
                         }
                         return token;
                     }
    

    I've added JSON config file in app/ directory and added dependencies:

         buildscript {
    repositories {
        jcenter()
    }
    
    dependencies {
        classpath 'com.google.gms:google-services:1.5.0-beta2'
    }
         }
    
    
         dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.+'
    compile 'com.firebase:firebase-client-android:2.3.0+'
    
    /* For Google Play Services */
    compile 'com.google.android.gms:play-services-safetynet:8.3.0'
    compile 'com.google.android.gms:play-services-auth:8.3.0'
    compile 'com.google.android.gms:play-services:8.3.0'
    
    compile('com.afollestad.material-dialogs:core:0.8.3.0@aar') {
        transitive = true
    }
    
    /* Firebase UI */
    compile 'com.firebaseui:firebase-ui:0.2.2'
    
    compile 'com.android.support:cardview-v7:23.1.+'
    compile 'com.android.support:recyclerview-v7:23.1.+'
    compile 'com.android.support:design:23.1.+'
    
    
         }
         apply plugin: 'com.google.gms.google-services'
    

    I am looking for solution hours already... Please help!!