如何确定访问令牌的范围

时间:2014-10-14 09:54:51

标签: google-oauth

标题说明了一切。在Google API中是否存在API调用,当给定access_token或refresh_token时,它会返回授予该令牌的范围。我在Google的文档中找不到关于这个问题的任何内容。

1 个答案:

答案 0 :(得分:2)

是的!

只需拨打此网址:

https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=XXXXX

结果如下所示。如果您在令牌中包含与电子邮件相关的范围,则只会收到电子邮件。

{
 "issued_to": "407408718192.apps.googleusercontent.com",
 "audience": "407408718192.apps.googleusercontent.com",
 "user_id": "1170123456778279183758",
 "scope": "https://www.googleapis.com/auth/userinfo.email",
 "expires_in": 3585,
 "email": "someone@yourdomain.com",
 "verified_email": true,
 "access_type": "offline"
}

More info on this blog post

相关问题