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:
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);Account chooser is displayed, so choose an account.
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):
- Go to the system settings -> accounts and remove account I tried to login with.
- Switch back to the app
- Click to login icon(previously presented code is executed)
- Opens an Activity which says that I signed out of my account and have to login again.
- 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}