GoogleApiClient状态12501错误登录

时间:2017-10-24 14:33:49

标签: android

我在20%的用户群登录中获得了severe error

使用Auth.GOOGLE_SIGN_IN_API的GoogleApiClient有时会在12501获取状态release environment

我自己无法重现。我注意到许多人在StackOverflow中有同样的疑问,甚至按照他们的提示,但我仍然无法解决问题。

根据Google documentation,我使用与我的oauth web api密钥关联的requestIdToken。显然一切都很好。有人可以帮帮我吗?有小费吗?谢谢你的帮助。

private void configureGoogleSignIn() {
    try {
        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail()
                .requestId()
                .requestIdToken(getResources().getString(R.string.oauth_web_google_signin))
                .build();
        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .enableAutoManage(this, this)
                .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
                .addApi(Auth.CREDENTIALS_API)
                .build();
    }
    catch(Exception e) {
        WrapperLog.logError(GeneralLogin.class, e);
    }
}


@OnClick(R.id.sign_in_button)
public void onClickGoogleSignIn() {
    Log.i(TAG, "clicked to google sign in");
    try {
        showProgressLoading();
        Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
        startActivityForResult(signInIntent, RC_SIGN_IN);
    }
    catch(Exception e) {
        WrapperLog.logError(GeneralLogin.class, e);
        errorLogoutGoogle();
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        handleSignInResult(result);
        return;
    }
}

private void handleSignInResult(GoogleSignInResult result) {

    // Inner User login methods

}

0 个答案:

没有答案