为什么 Google Calendar API (oauth2) 响应“权限不足"? [英] Why is Google Calendar API (oauth2) responding with 'Insufficient Permission'?
问题描述
我正在向以下 URL 发出 get 请求({id} 替换为来自 Web 界面的 id):
I'm doing a get request to the following URL (with {id} replaced with the id from the web interface):
https://www.googleapis.com/calendar/v3/calendars/{id}
一些断言:
已使用有效的访问令牌正确设置了 Authorize 标头(该令牌适用于 Analytics API)
The Authorize header is being correctly set with a valid access token (the token works fine for the Analytics API)
我为 oauth2 设置了以下范围,它显示正确:
I've set the following scope for oauth2, which shows up correctly:
https://www.googleapis.com/auth/calendar
令牌似乎没有过期;它适用于 Analytics API.
The token doesn't appear to have expired; it works for the Analytics API.
{ "error": { "errors": [ { "domain": "global", "reason": "insufficientPermissions", "message": "Insufficient Permission" } ], "code": 403, "message": "Insufficient Permission" } }
推荐答案
为了解决这个问题,我撤销了对 应用程序的访问权限https://accounts.google.com/IssuedAuthSubTokens 并重试之后,我能够正确访问 API.
To fix, I revoked access to the app at https://accounts.google.com/IssuedAuthSubTokens and retried after which, I was able to access the API correctly.
尽管该范围在列表中,并且该范围显示在 Google 的 OAuth2 授权页面上,但并未授予额外的范围.
Despite having the scope in the list, and the scope showing up on Google's OAuth2 grant page, the additional scope wasn't granted.
这篇关于为什么 Google Calendar API (oauth2) 响应“权限不足"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!