Javascript 谷歌网站登录-如何获取令牌
我正在使用谷歌登录网站 根据文档,在函数Javascript 谷歌网站登录-如何获取令牌,javascript,html,authentication,google-authentication,google-oauth,Javascript,Html,Authentication,Google Authentication,Google Oauth,我正在使用谷歌登录网站 根据文档,在函数onSignIn(googleUser)下,我使用googleUser.getAuthResponse().ID\u令牌获得ID\u令牌 但显然这不是我将来可以用来撤销的access\u令牌。如何从googleUser对象获取客户端的访问\u令牌?在回拨中检查googleUser。您将在其中找到Zi属性。在该对象中,您将发现访问\u令牌和过期时间 function onSignIn(googleUser) { console.log(googleU
onSignIn(googleUser)
下,我使用googleUser.getAuthResponse().ID\u令牌获得ID\u令牌
但显然这不是我将来可以用来撤销的
access\u令牌。如何从googleUser对象获取客户端的访问\u令牌
?在回拨中检查googleUser
。您将在其中找到Zi
属性。在该对象中,您将发现访问\u令牌
和过期
时间
function onSignIn(googleUser) {
console.log(googleUser.Zi);
}
经过几个小时的努力,我终于从一位谷歌开发者那里得到了答案
使用下面的行。在getAuthResponse
函数中传递true
将返回access\u令牌
和到期
。这是推荐的解决方案
googleUser.getAuthResponse(true).access_token;