如果用户更改了Google帐户密码,如何注销?

时间:2016-06-29 16:20:04

标签: google-login

我已成功使用Google登录,但现在我想在更改其Google帐户密码时退出该用户。

我尝试过以下代码:

  OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d("TAG", "Got cached sign-in");
        GoogleSignInResult result = opr.get();
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {

            }
        });
    }

...但即使在更改密码和撤销访问权限之后,我也可以默默登录。我找不到任何其他东西。

有人可以帮助我检测用户是否更改了密码,以便我可以将他退出?

1 个答案:

答案 0 :(得分:0)

我发现了同样的问题。 https://github.com/googlesamples/google-services/issues/196

根据它们的预期行为,您可能需要从应用程序中明确调用signOut或revokeAccess才能实现此目的。

相关问题