1

i want to log in to my google account in my app. this here works well: https://developers.google.com/identity/sign-in/android/sign-in#configure_google_sign-in_and_the_googleapiclient_object, but if i try to request the idtoken, it doesn't work. changing

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .build();

to

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

after clicking the login button the log of this code

    @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.i(TAG, "on activity result " + requestCode);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        Log.i(TAG, "on activity result " + requestCode + " success: " + result.isSuccess());
        handleSignInResult(result);
    }
}

private void handleSignInResult(GoogleSignInResult result) {
    Log.i(TAG, "handleSignInResult: " + result.isSuccess());
    if (result.isSuccess()) {
        GoogleSignInAccount acct = result.getSignInAccount();
        Intent intent = new Intent(this, MainActivity.class);
        intent.putExtra(ACCOUNT_INFO, acct);
        startActivity(intent);
    }
}

says:

on activity result 9001
on activity result 9001 success: false
handleSignInResult: false

why doesn't it log in, when i ask for requestidtoken? i need it for authentification with my websevice.

i got "somelettersandnumbers.apps.googleusercontent.com" like this: https://developers.google.com/identity/sign-in/android/start-integrating#get_your_backend_servers_oauth_20_client_id. do i only need the client-id, not the client-key?

1 Answers1

0

*close

just sign the app. use the keystore, not the debug keys. thanks to New Google sign in Android

Community
  • 1
  • 1