我正在集成Android的Google登录,并且我希望返回id_token以便可以通过服务器进行身份验证。我遵循了https://developers.google.com/identity/sign-in/android/backend-auth
中的所有步骤问题在于onActivityResult()的结果代码为0
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken(getString(R.string.server_client_id))
.build();
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
onActivityResult:
super.onActivityResult(requestCode, resultCode, data);
Log.d(TAG, "data : " + resultCode + " | " + data + " || " + RC_SIGN_IN + " ||| " + requestCode);
你知道为什么resultCode总是等于0(RESULT_CANCELED)吗?