我'm integrating google drive into my app with Google Drive API and needed to use Google Sign In API to access the account. I'已经使用the guide by Google从Google API控制台生成了我的userTokenID(我使用了Web客户端OAuth 2.0) . 这是我的单曲GSO:

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .requestIdToken(getString(R.string.google_id_client)) 
            .requestScopes(Drive.SCOPE_APPFOLDER)
            .requestScopes(Drive.SCOPE_FILE)
            .build();

Before Log in

问题在于,当选择的新帐户注册时,如下图所示:

Add new account selected

并且注册结束,屏幕保持灰色,如下所示:

Screen stays grey after sign in

并且onActivityResult()由于某种原因从未被调用过 . 点击覆盖屏幕后,所有内容都回到了开始状态,我在代码的这一部分中收到了Google错误代码8:INTERNAL ERROR:

private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
    try {
        // Signed in successfully, show authenticated UI.
        if (completedTask.getResult(ApiException.class) != null) {
            mPresenter.firstPreparations();
            selectedItems = new ArrayList<>();
            changeVisibility(true);
        }
    } catch (ApiException e) {
        // The ApiException status code indicates the detailed failure reason.
        // Please refer to the GoogleSignInStatusCodes class reference for more information.
        Log.e(TAG, e.getStatusCode()+"");
        changeVisibility(false);
    }
}

登录仅在手机上注册帐户时有效 .

我尝试过的:

  • 生成新的tokenID以防我生成错误,但没有用

  • 不使用tokenID,但方案是相同的