无法在Google服务帐户中将acl规则写入主日历

时间:2015-11-07 17:02:47

标签: google-api google-calendar-api

所以我为我的某个应用设置了一个Google服务帐户。我的目的是保持与管理门户关联的谷歌日历,所有管理员都可以发布事件。我有JWT auth工作我可以将事件发布到日历并执行其他API操作。但是,出于某种原因,我无法更改主日历上的访问控制规则。它使用单个acl规则初始化(role:owner,scope:{type:user,value:service_account_id}),当我尝试添加公共读取访问权限(role:reader,scope:{type:default})时:

POST https://www.googleapis.com/calendar/v3/calendars/primary/acl
Authorization: Bearer my_jwt_here

{
    "role":"reader",
    "scope":{
        "type":"default"
    }
}

我收到以下错误:

{
  "error": {
    "errors": [
      {
        "domain": "calendar",
        "reason": "cannotRemoveLastCalendarOwnerFromAcl",
        "message": "Cannot remove the last owner of a calendar from the access control list."
      }
    ],
    "code": 403,
    "message": "Cannot remove the last owner of a calendar from the access control list."
  }
}

这对我没有任何意义,因为此请求不应该尝试删除任何访问控制规则。当我创建辅助日历并执行此操作时,我没有任何问题。当我使用个人Google帐户的主日历执行此操作时,我没有任何问题。这是一些特定于我不熟悉的服务帐户的行为或者是什么?我可以满足于使用非主要日历,但令我困扰的是,这不起作用。任何建议都表示赞赏。

0 个答案:

没有答案