Youtube Live Streaming API has really thorough documentation, and I went through it as well as usage examples. Recently I started to get 403 error.
The full signature of the error is:
Error calling POST
https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet%2Cstatus%2CcontentDetails:
(403) Request is not authorized
And I can't find out the reason behind it. On a day start it was all working fine with a google account credentials and OAuth keys. Then after a few requests succeeded it went down with the 403. Same credentials and keys were used.
I strongly believe there are limitations in play, but which are this limitations or how to bypass them I can't help to find in docs or elsewhere.
the code goes like this (up to the breaking point):
$liveStreamingApi = new LiveStreamingApi();
$youtube = $liveStreamingApi->setLiveBroadcasts($returnUrl, null, LiveStreamingApi::CREATE);
$broadcastSnippet = new \Google_Service_YouTube_LiveBroadcastSnippet();
$broadcastSnippet->setTitle($model->name);
$broadcastSnippet->setScheduledStartTime(STARTTIME);
$broadcastSnippet->setIsDefaultBroadcast('1');
$status = new \Google_Service_YouTube_LiveBroadcastStatus();
$status->setPrivacyStatus($privacy);
$broadcastInsert = new \Google_Service_YouTube_LiveBroadcast();
$broadcastInsert->setSnippet($broadcastSnippet);
$broadcastInsert->setStatus($status);
$broadcastInsert->setKind('youtube#liveBroadcast');
$broadcastsResponse = $youtube->liveBroadcasts->insert('snippet,status,contentDetails', $broadcastInsert, array());
where $liveStreamingApi->setLiveBroadcasts sets all the essential scopes in https (force-ssl, youtube, youtubepartner) $youtube->liveBroadcasts->insert throws the aforementioned error