2

I have an issue which connected to GoogleSignIn Library. In my app I'm trying to login with Google account, but dialog which asks for permissions(such as Offline access) is looped.

Please, pay attention that this issue is reproduced only on one device and works well on others. So I suppose that this issue doesn't connected to Client Id configuration on Google console and etc.

  • Device: Xiaomi Redmi Note 2
  • Android version: 5.0.2 LRX22G
  • Play Services: 11.5.09(248-164803921)
  • Gradle dependencies: compile "com.google.android.gms:play-services-auth:11.0.4"

Steps:

  1. Run Sign in process:

        if (mGoogleApiClient == null) {  GoogleSignInOptions.Builder gsoBuilder =
                new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                        .requestEmail()
                        .requestServerAuthCode(BuildConfig.GOOGLE_WEB_CLIENT_ID, true)
                        .requestScopes(
                                new Scope("https://mail.google.com/"),
                                new Scope("https://www.googleapis.com/auth/contacts.readonly"));
    
        if (mLoginRequestAccountEmail != null) {
            gsoBuilder.setAccountName(mLoginRequestAccountEmail);
        }
        GoogleSignInOptions gso = gsoBuilder.build();
    
        mGoogleApiClient = new GoogleApiClient.Builder(RegisterPromptActivity.this)
                .enableAutoManage(RegisterPromptActivity.this,
                        new GoogleApiClient.OnConnectionFailedListener() {
                            @Override
                            public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    
                            }
                        })
                .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
                .build();
    } else {
        if (mGoogleApiClient.isConnected()) {
            mGoogleApiClient.clearDefaultAccountAndReconnect();
        }
    }
    
    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, GOOGLE_SIGN_IN_REQUEST_CODE);
    
  2. Account chooser is displayed, so choose an account.

  3. Dialog is poped up. Click 'Allow'.

Result: This dialog pops up again after I clicked 'Allow' button.

You can see the steps on the video.


SOME MORE DETAILS

After these steps i can get an error in OnActivityResult method.

Steps(video):

  1. Go to the system settings -> accounts and remove account I tried to login with.
  2. Switch back to the app
  3. Click to login icon(previously presented code is executed)
  4. Opens an Activity which says that I signed out of my account and have to login again.
  5. Click 'next' and enter password and click 'Next'

Result: In OnActivityResult returns an Intent with resultCode: ACTIVITY_CANCELED and there is an error: Status{statusCode=unknown status code: 12501, resolution=null}

AinisSK
  • 306
  • 1
  • 10
  • have you tried solutions provided in this link https://stackoverflow.com/questions/33846801/error-12501-authenticating-with-google-sign-in – Amod Gokhale Oct 31 '17 at 10:31
  • No, there aren't any solutions which would fit my case. The thing is the problem in `.requestServerAuthCode(BuildConfig.GOOGLE_WEB_CLIENT_ID, true)` line. Without this authorization works, but I need _ServerAuthCode_ – AinisSK Oct 31 '17 at 10:50
  • if this works on other devices and not on your Xiaomi phone, couldnt this be a device issue? To confirm that, try this on other Android version: 5.0.2 LRX22G phones, like Samsung,etc – ReyAnthonyRenacia Nov 01 '17 at 08:53
  • 1
    Did you manage to solve this? Do you remember how? – grebulon Apr 01 '20 at 17:50

0 Answers0