Google service account permission YouTube upload via API v3

I want to automatically upload videos to YouTube without user intervention, so I created a service account, jumped over the hoops, everything looked great, then the download was downloaded, a piece, and my code bombed this Google_Exception

"Failed to start renewable download (HTTP 401: youtube.header, Unauthorized)"

Then I dug up and found in the YouTube v3 API error information:

https://developers.google.com/youtube/v3/docs/errors

"This error is usually observed if you try to use the OAuth 2.0 service account stream. YouTube does not support service accounts , and if you try to authenticate with the service account, you will get this error."

It is right? Can't I use a service account to automatically upload videos to YouTube?

(it was a waste of several days of hard work!)

+6
source share
1 answer

Yes this is correct.

The way forward is to manually authorize and get the resulting update token, and then use it for any automatic downloads.

Ensure that the update token is added to the Google_Client PHP object before any other action.

Now I automatically upload to YouTube.

+8
source

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


All Articles