google-api - 范围 https ://www. googleapis.com/auth/calendar.app.created 的 Google Calendar API 请求被拒绝

标签 google-api calendar google-oauth google-calendar-api

我的应用程序需要创建一个 Google 日历并为用户管理其中的事件。 Google API Console 允许为此范围创建同意书:
https://www.googleapis.com/auth/calendar.app.created
它应该允许在这些日历中创建辅助日历和事件。说明如下:

Make secondary Google calendars, and see, create, change, and delete events on them


但是,在用户通过同意书等给予许可后,我在尝试创建日历时收到 PERMISSION_DENIED(我正在使用 REST api https://www.googleapis.com/calendar/v3/calendars)
{
  "error": {
    "code": 403,
    "message": "Request had insufficient authentication scopes.",
    "errors": [
      {
        "message": "Insufficient Permission",
        "domain": "global",
        "reason": "insufficientPermissions"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}
我的代码和其余的管道(授权代码、访问 token 等)工作,因为如果我使用这个范围:
https://www.googleapis.com/auth/calendar
我能够创建日历。
所以,有人知道 https://www.googleapis.com/auth/calendar.app.created已弃用还是什么?它没有列在 V3 日历文档中,但我希望它继续工作。我不想要求用户获得对所有日历的完全许可,因为我只想创建和访问辅助日历,并且该范围应该完全满足我的需要。
想法?

最佳答案

  • 正如您在 OAuth 2.0 Scopes for Google APIs 下看到的, https://www.googleapis.com/auth/calendar.app.created不是 Calendar API v3 的有效范围。
  • Calendars:insert 的文档声明创建新日历的唯一有效范围是 https://www.googleapis.com/auth/calendar
  • 您会注意到,如果您尝试使用 https://www.googleapis.com/auth/calendar.app.created 创建日历- 无论是在 OAuth2 操场上还是其他地方 - 请求失败并显示 403 错误

  • 结论
    不幸的是https://www.googleapis.com/auth/calendar.app.created不是有效范围,在 OAuth2 playground 上接受此范围是一个错误。

    关于google-api - 范围 https ://www. googleapis.com/auth/calendar.app.created 的 Google Calendar API 请求被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64474688/

    相关文章:

    java - 如何使用 GregorianCalendar 在 Java 中获取当前周数和年份?

    ios - 无法从用户界面删除以编程方式创建的日历

    java - 如何在 Java 的 Calendar 类中获取用户输入的日期而不是当前日期?

    oauth-2.0 - 管理 Google Sheets API 刷新 token

    google-apps-script - 尝试授权脚本时出现 "Sign in with Google temporarily disabled for this app"错误

    google-chrome-extension - 运行 chrome 扩展的 identity.getAuthToken 时出现错误 'Service has been disabled for this account'

    javascript - React nodemailer net.isIP 不是函数

    java - "Invalid credentials"Google plus with request/plus/v1/people/me

    java - 自动登录 Gmail

    python - Google OAuth 不会在 authlib.starlette_client 中返回refresh_token