Google登录:检测用户授予身份验证

时间:2017-03-03 08:09:02

标签: authentication google-signin gapi

我使用了谷歌提供的两个版本的基本google sigin代码:

https://developers.google.com/identity/sign-in/web/

https://developers.google.com/identity/sign-in/web/build-button

此代码告诉我用户何时使用Google登录。

我现在需要的是只有在用户点击了“#34;允许"谷歌想要查看用户的个人资料的谷歌弹出窗口,所以我可以检测到用户点击该按钮的时间。

1 个答案:

答案 0 :(得分:0)

以下是我如何解决它:

function onSuccess(googleUser) {
  if (googleUser.getAuthResponse().hasOwnProperty("access_token"))
      { /* CODE TO BE EXECUTED ONLY AFTER USER HAS ALLOWED ACCESS */ }
}