문제

If I have a valid Google Access token, is there an easy way to find out what scopes this token is valid for? This issue has arisen because the scopes were not saved when the user initially authorised the token.

도움이 되었습니까?

해결책

The only way you can find the scope of a token is to validate this token by this API:

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

And you'll get a response which includes the scope and other pieces of information like this:

{
  "audience":"8819957365.apps.googleusercontent.com",
  "user_id":"123456789",
  "scope":"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
  "expires_in":3500
}

See the Google Developer documentation for more info.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top