Google Youtube Analytics API: 403 forbidden error despite valid token

So, I have a valid OAuth token for the channel. When the token expires, it is automatically updated. This token works for gdata.youtube.com requests, but for some reason it was denied at www.googleapis.com/youtube/analytics/v1/reports .

The area used to obtain the token is https://gdata.youtube.com https://www.googleapis.com/auth/yt-analytics.readonly https://www.googleapis.com/auth/youtubepartner

This works for other channels, but not in particular.

 GET www.googleapis.com/youtube/analytics/v1/reports PARAMS ?metrics=views &ids=channel==... &start-date=... &end-date=... HEADER Authorization: Bearer ... RESPONSE { "error": { "errors": [ { "domain": "global", "reason": "forbidden", "message": "Forbidden" } ], "code": 403, "message": "Forbidden" } } 

Edit : It should be noted that when you call www.googleapis.com/youtube/analytics/v1/reports with insufficient scope, you will receive this error:

 {domain:global, reason:insufficientPermissions, message:Insufficient Permission} 

This is a completely different mistake from the forbidden 403.

+6
source share
2 answers

We encountered the same permission error. If the user is no different from the Youtube affiliate program, you will not be able to receive content owner reports:

https://developers.google.com/youtube/analytics/v1/content_owner_reports

"Note: Content owner reports are only available to YouTube content partners who participate in the YouTube Partner Program.

But you can still get channel reports for regular users:

https://developers.google.com/youtube/analytics/v1/channel_reports

+1
source

You probably need to enable YouTube Analytics for your project. Go to the API console: https://code.google.com/apis/console , select your project, then click the services tab, find YouTube Analytics and enable it after reading and accepting ToS. Do not forget to confirm that the free quota is enough for your purposes or request an additional quota.

0
source

Source: https://habr.com/ru/post/945210/


All Articles