Google Calendar Update/Patch API返回403错误排查求助
G Suite资源日历事件API更新/Patch接口403权限问题排查
背景信息
- 在G Suite中添加了若干资源,计划通过API管理这些资源的日历事件
- 认证与授权配置:已在开发者控制台生成OAuth凭据、API密钥,配置权限范围
SCOPES = ['https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.events'];已通过Google日历设置与共享功能,将资源日历邮箱共享至个人日历
问题现象
- GET接口可正常调用,但调用Update/Patch接口时返回403错误;使用Google API Explorer测试时也出现相同403错误
- 若传入错误请求体返回400错误,请求体格式正确时则返回403
已完成排查项
- 验证权限范围:从令牌响应及账号第三方应用设置中确认,权限配置无误
- 检查日历共享设置:确认共享配置无问题
测试用Curl命令
curl --location --request PATCH 'https://www.googleapis.com/calendar/v3/calendars/my_resource.calendar.google.com/events/<event_id>>' \ --header 'Authorization: Bearer <token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data-raw '{ "status": "cancelled" }'
补充说明
- 令牌归属G Suite用户账号
user@custom_domain.com - CalendarID为G Suite资源
my_resource.calendar.google.com - 事件由该用户创建,并选择此资源作为会议室;资源邮箱已添加至用户日历,理论上具备该资源日历事件的管理权限
错误返回内容
{ "error": { "errors": [ { "domain": "global", "reason": "forbidden", "message": "Forbidden" } ], "code": 403, "message": "Forbidden" } }
疑问
还有哪些配置项可能被遗漏?
内容的提问来源于stack exchange,提问作者user5594493
相关产品推荐
相关产品推荐

