0
votes

I am trying to fetch auditDetails of YouTube channels.

As per official API docs (https://developers.google.com/youtube/v3/docs/channels/list) I am supposed to provide an authorization token that contains the https://www.googleapis.com/auth/youtubepartner-channel-audit scope.

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.

I am currently trying to fetch a YouTube channel's auditDetails by hitting following URL:

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

But, it is returning an Insufficient Permission error as follows:

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

Can someone suggest me an approach to generate youtubepartner-channel-audit scope for various YouTube channels.

2

2 Answers

0
votes

The error you have encountered means that:

The OAuth 2.0 token provided for the request specifies scopes that are insufficient for accessing the requested data.

You can request for authorization of auditDetails part for 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.

After that, you can add your scope to the OAuth sign-in request.

0
votes

In order to introduce scopes, an authorization token containing those scopes needs to be created.

Authorization credentials can be created via the Credentials page in the API Console.

Create credentials

But before creating OAuth client ID authorization credentials, user is required to set a product name on the consent screen.

On the consent screen itself user can add multiple scopes as per application requirement.

Add scope