为什么Google Calendar API(oauth2)以“权限不足”进行响应? [英] Why is Google Calendar API (oauth2) responding with 'Insufficient Permission'?

查看:521
本文介绍了为什么Google Calendar API(oauth2)以“权限不足”进行响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向以下网址发送获取请求(将{id}替换为来自网络界面的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}

https://www.googleapis.com/calendar/v3/calendars/{id}

几个断言:


  1. 授权标题正确设置有效的访问令牌(该令牌适用于Google Analytics(分析)API)

  2. 我为oauth2设置了以下作用域: https://www.googleapis.com/auth/calendar

  3. 令牌似乎未过期;它适用于Google Analytics(分析)API。

  1. The Authorize header is being correctly set with a valid access token (the token works fine for the Analytics API)
  2. I've set the following scope for oauth2, which shows up correctly: https://www.googleapis.com/auth/calendar
  3. The token doesn't appear to have expired; it works for the Analytics API.

{error:{errors:[{domain:global,reason:insufficientPermissions message:权限不足}],code:403,message:权限不足}}

{ "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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆