0

I am getting problem for my current app. My OAuth2.0 the SHA1 is correct and generated from keystore file of release version. My problem is I am receiving resultCode =0 everytime on onActivityResult. I print out value of intent and got below: googleSignInStatus=Status{statusCode=INTERNAL_ERROR, resolution=null} But, if I run it on debug mode login working perfectly and for this case value of intent is: googleSignInAccount=com.google.android.gms.auth.api.signin.GoogleSignInAccount@31976389]

Do anybody knows how to solve this problem. NOTE: Somewhere I found one post they recommend to put Email and Project name on OAuth Contest Screen; I already tried that and still not working.

silwalprabin
  • 637
  • 7
  • 20

1 Answers1

2

Obviously first check your release sha1 key is correct or not. But issue here was different. I am using new google play services (i.e.compile 'com.google.android.gms:play-services:8.4.0'). And issue could be solved by modifying GoogleSignInOption object. Instead of:

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                    .requestEmail()  
       .requestIdToken("YOUR_WEB_API_ID.apps.googleusercontent.com")
                    .build();

I use :

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestScopes(new Scope(Scopes.PLUS_LOGIN))
                .requestScopes(new Scope(Scopes.PLUS_ME))
                .requestEmail()
                .build();

This solves error returning statusCode=INTERNAL_ERROR . Then this gso object could be used for creating GoogleApiClient as shown below:

 mGoogleApiClient = new GoogleApiClient.Builder(this)
                .enableAutoManage(this, this)
                .addApi(Auth.GOOGLE_SIGN_IN_API,gso)
               // .addApi(Plus.API, null)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
               // .addScope(Plus.SCOPE_PLUS_LOGIN)
                .build(); 
silwalprabin
  • 637
  • 7
  • 20
  • For me ,it was the sha1 i published my app with debug sha ,I then added generated and added release sha1 to my server project setting ,and i 'm ready to go. – Odai A. Ali Jan 19 '19 at 15:40