【问题标题】:Fetch auditDetails of YouTube channel获取 YouTube 频道的审核详细信息
【发布时间】:2019-03-08 09:12:53
【问题描述】:

我正在尝试获取 YouTube 频道的 auditDetails

根据官方 API 文档 (https://developers.google.com/youtube/v3/docs/channels/list),我应该提供一个包含 https://www.googleapis.com/auth/youtubepartner-channel-audit 范围的授权令牌。

Authorization

A request that retrieves the auditDetails part for a channel resource must provide an authorization token that contains the https://www.googleapis.com/auth/youtubepartner-channel-audit scope. In addition, any token that uses that scope must be revoked when the MCN decides to accept or reject the channel or within two weeks of the date that the token was issued.

我目前正在尝试通过点击以下 URL 来获取 YouTube 频道的 auditDetails:

https://www.googleapis.com/youtube/v3/channels?key=xxxxxxxxxx&id=UC9eSXrzVl9ZFLwsNSBgvTog&part=auditDetails

但是,它返回 Insufficient Permission 错误,如下所示:

{
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "insufficientPermissions",
        "message": "Insufficient Permission"
      }
    ],
  "code": 403,
  "message": "Insufficient Permission"
  }
}

有人可以建议我为各种 YouTube 频道生成 youtubepartner-channel-audit 范围 的方法吗?

【问题讨论】:

    标签: youtube-api youtube-data-api


    【解决方案1】:

    为了引入scopes,需要创建一个包含这些范围的authorization token

    可以通过 API 控制台中的 Credentials page 创建授权凭证。

    Create credentials

    但在创建 OAuth 客户端 ID 授权凭证之前,用户需要在 consent screen 上设置产品名称。

    consent screen 本身用户可以根据应用要求添加多个scopes

    Add scope

    【讨论】:

      【解决方案2】:

      你遇到的error表示:

      为请求提供的 OAuth 2.0 令牌 指定的范围是 不足以访问请求的数据。

      您可以request for authorization of auditDetails部分获取频道资源:

      必须提供一个authorization token,其中包含 https://www.googleapis.com/auth/youtubepartner-channel-audit 范围。在 此外,当MCN 决定接受或拒绝该频道或在两周内 令牌的发行日期。

      之后,您可以将您的范围添加到 OAuth 登录请求中。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-04-20
        • 1970-01-01
        • 1970-01-01
        • 2016-09-13
        • 2016-05-23
        • 1970-01-01
        • 2014-10-15
        • 2011-06-06
        相关资源
        最近更新 更多