使用api的服务帐户无法看到Google日历列表 [英] Google Calendar list not visible for Service Accounts using api

查看:65
本文介绍了使用api的服务帐户无法看到Google日历列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Google Calendar API的新手,我已经为OAuth流程创建了服务帐户,然后使用JWT获取了访问令牌.然后,我尝试获取日历列表,但响应未获取日历列表.我正在使用具有域的企业帐户.我想查看我的组织用户日历列表.

I am new to Google Calendar API, I had created the Service Account for OAuth process and then I get the access token using JWT. Then I try to fetch the calendar list but the response didn't fetch the calendar list. I am using business account with domain. I want to view my organization user calendar list.

响应:

{
  "kind": "calendar#calendarList",
  "etag": "\"p3208dll2qn2d60g\"",

  "nextSyncToken": "CICG1qLVxNMCEjBtZWV0aW5nQHBvbGV0dXMtY2FsZW5kYXIuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20=",
  "items": []
} 

具有SuperAdmin访问权限的组织用户.我使用服务帐户对我的普通gmail帐户进行了测试,该帐户适用于所有api请求.

The Organization user having the SuperAdmin access. And I tested with my normal gmail account using service accounts it works for all api requests.

推荐答案

记住服务帐户不是您.服务帐户是虚拟用户,它具有自己的Google日历帐户.假设您确实与服务帐户共享了相关日历,则可能未将其添加到日历列表中.

Remember a service account is not you. A service account is a dummy user it has its own Google calendar account. Assuming that you did share the calendar in question with the Service account it may not have been added to the calendar list.

所有日历列表是GUI左下角的列表.有时,当您与服务帐户共享日历时,该日历未正确添加到日历列表中.您可以通过运行 calendarlist.insert,通过服务帐户自己添加它.

All calendar list is the list on the bottom left hand side of the GUI. Sometimes when you share a calendar with a service account it doesn't get added properly to the calendar list. You can add it yourself via the service account by running calendarlist.insert

假设您尚未授予服务器帐户读取日历的权限,则需要像使用服务帐户电子邮件地址的任何其他用户一样共享它,以进行共享.

Assuming that you have not granted the server account permissions to read the calendar you will need to do so by sharing it like you would any other user using the service account email address.

这篇关于使用api的服务帐户无法看到Google日历列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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