How to grant access to Youtube Reporting API for a google service account?

天涯浪子 提交于 2019-12-12 02:35:28

问题


I am trying to access YouTube Reporting API with a service account. But I am getting a 403 forbidden when trying to do youtubeReporting.jobs().list().execute().

YouTube Reporting API clearly supposed Server-to-server interaction.

Do I need to grant access to Youtube Reporting API for a google service account? If so, how?

FYI : I am not using google app domain.


回答1:


You can do that in the Cloud Platform Console. See https://support.google.com/cloud/answer/6158841?hl=en for details




回答2:


You could create service credentials in the google console, but those credentials won't fix your issue. According to the docs,

The service account flow supports server-to-server interactions that do not access user information. However, the YouTube Reporting API and YouTube Analytics API do not support this flow. Since there is no way to link a Service Account to a YouTube account, attempts to authorize requests with this flow will generate an error.

It is p counter-intuitive-- (not to mention hard to locate)-- this info esp. since conceptually related YT APIs utilize service accounts, see here, and the reporting api actions wouldn't seem to need to be associated w/ a specific user account.

Unfortunately, if you use a service account for the Youtube Reporting API you will still end up with a 403 unauthorized caller error.

Instead, create and use web client google credentials. Store and use the token generated from the flow.



来源:https://stackoverflow.com/questions/38339956/how-to-grant-access-to-youtube-reporting-api-for-a-google-service-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!