When the application starts, I create an instance of GoogleSignInClient as follows:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.server_client_id)) .requestEmail() .build(); mGoogleSignInClient = GoogleSignIn.getClient(this, gso); At the same time, the server_client_id lives on a string obtained via credentials.json when registering the application in Google account. I try to log in using the button:
Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); After selecting an account in authorization activity in onActivityResult, I get a Task and an account from it:
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); GoogleSignInAccount account = task.getResult(ApiException.class); but calling the last line causes an ApiException with error code 10