代码之家  ›  专栏  ›  技术社区  ›  Code Your Dream

Google应用程序脚本突然失去了对日历API的访问

  •  1
  • Code Your Dream  · 技术社区  · 7 年前

    我有一个谷歌应用程序脚本,它从我的谷歌日历中检索事件并处理它们。 大约3-4小时前它工作得很好,但在某个时候它只是停止工作了。

    错误发生在第行:

    var calendar = CalendarApp.getOwnedCalendarsByName('calendar name')[0];
    

    错误显示“脚本没有执行此操作的权限。所需权限( https://www.googleapis.com/auth/calendar γ https://www.googleapis.com/auth/calendar.readonly γ https://www.google.com/calendar/feeds )

    我检查了谷歌日历API的配额,但我肯定不会超过那里设置的限制。

    1 回复  |  直到 7 年前
        1
  •  0
  •   Code Your Dream    7 年前

    正确的解决方案是显式指定清单文件中所需的权限,如下所述: "Authorisation is required to perform that action" message, even after clicking "Allow"

    只需将错误中提到的URL添加到OAuthScopes数组。