Skip to content

GoogleSignInResult returns Status{statusCode=unknown status code: 12501, resolution=null} when requesting Token #4509

@ojarabo

Description

@ojarabo

Hi there,
I am trying to enable google auth in my app. I have been following your example, but it didn't work.

In you example, you request the IdToken in the GoogleSignInOptions.Builder

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

to later use it onRegistrationComplete

 googleAuthLogin     = new GoogleAuth((Button) findViewById(R.id.google_default_button), this) {
            @Override
            public void onRegistrationComplete(GoogleSignInResult result) {
                UserManager.setAuthMode(UserManager.AUTH_MODE.GOOGLE);
                GoogleSignInAccount acct = result.getSignInAccount();
                SyncCredentials credentials = SyncCredentials.google(acct.getIdToken());
                SyncUser.loginAsync(credentials, AUTH_URL, SplashScreenActivity.this);
            }

            @Override
            public void onError(String s) {
                super.onError(s);
            }
        };

I have registered my app in the google console as an Android Client. However, during the execution, my app never got onRegistrationComplete because GoogleSignInResult returned a status code 12501.

I have been researching for a while an I have discovered that if I enabled the Outh client as a web application the error would disappear. However, my app will never reach onSuccess. It would instead call onError with a value of INVALID_CREDENTIALS. This is caused because the IdToken is linked to the web application and not to the Android Client, so the credentials don't match.

Could you please clarify if the app has to be only declared as a web application or if I am doing something else wrong?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions