【问题标题】:Alert Center API Scope issue警报中心 API 范围问题
【发布时间】:2021-02-09 02:47:54
【问题描述】:

根据文档: https://developers.google.com/admin-sdk/alertcenter/reference/rest/v1beta1/TopLevel/getSettings#authorization-scopes

还有发现文件: https://alertcenter.googleapis.com/$discovery/rest?version=v1beta1

“警报中心 API”的范围是 https://www.googleapis.com/auth/apps.alerts

但是,当我使用此范围时,我收到错误消息:

Authorization Error
Error 400: invalid_scope
Some requested scopes cannot be shown: [https://www.googleapis.com/auth/apps.alerts]

范围是否发生了变化,文档是否已过时?访问此 API 的任何其他选项?

【问题讨论】:

  • 嗨!您能否分享一个没有敏感数据的示例代码,我可以重现该代码以获得该错误消息?谢谢 ! :D
  • 嗨@mateorandwolf,我在谷歌路径游乐场测试了范围。我还没有写代码。 developers.google.com/oauthplayground。范围不在列表中,但您可以将其添加到列表末尾的文本字段中

标签: google-admin-sdk google-alerts google-alert-center-api


【解决方案1】:

出现此响应是因为您未将范围与服务帐户一起使用。如this piece of documentation所述:

您的项目在访问 API 时必须使用服务帐号。

因此,如果您使用服务帐户访问此 API,您将能够正确连接它,否则您将无法正确连接。更多关于服务账号授权here

另外,请注意范围G Suite Alert Center API v1beta1下的列表中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-03-19
    • 2019-01-18
    • 2014-06-30
    • 1970-01-01
    • 2021-01-03
    • 1970-01-01
    • 2016-11-07
    相关资源
    最近更新 更多