Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube Data API v3, Receiving 403 after creating multiple streams

I am using the Youtube Data API to create live broadcasts programatically. Within the hour, I am able to create around 5-6 streams at which point I will begin to receive 403 insufficientLivePermissions error. If I wait another 30 minutes and try again, it allows me to make 2 more broadcasts but will then return 403s again.

I checked to see if my access token was expired, but it works when making listing requests. It almost seems to be that I am getting rate limited. When I check my Youtube account however, all indicators are in green so I don't believe I am abusing their API.

This is the response from the YouTube Data v3 API:

{
  "error": {
    "errors": [
      {
        "domain": "youtube.liveBroadcast",
        "reason": "insufficientLivePermissions",
        "message": "Request is not authorized",
        "extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert#auth_required"
      }
    ],
    "code": 403,
    "message": "Request is not authorized"
  }
}

I am also not hitting anywhere near the Quota limits for the API. Any ideas to why the 403 insufficientLivePermissions would be much appreciated!

like image 981
Ulises Giacoman Avatar asked Mar 02 '17 18:03

Ulises Giacoman


People also ask

Why is YouTube API not working?

My YouTube API Key is Not Working Your API key may not be working because you're using it for the wrong project. Be sure you're using the key for the project that you created it for, especially if you created multiple projects at the same time. If it's still not working, consider creating a new API key entirely.

What is Error 403 in YouTube?

Description. forbidden (403) forbidden. Access forbidden. The request may not be properly authorized.


2 Answers

This issue means that you actually created too many live streams : if you go to https://www.youtube.com/my_live_events?action_create_live_event=1 and try to create a new livestream you will see :

You are creating too many live streams. Please wait a while before creating further streams.

I think the maximum is set to 6 to 7 streams per 24 hours.

ps : It's really not related to the issue in the documentation (missing scopes)

like image 180
M. Gara Avatar answered Sep 21 '22 11:09

M. Gara


Based on this documentation, the error insufficientLivePermissions means that the request is not authorized to create the live broadcast.

First, try to use the scope https://www.googleapis.com/auth/youtube.force-ssl together with https://www.googleapis.com/auth/youtube and check if the error 403 will gone.

If not, then I suggest you to check this YouTube Live Streaming API - Understanding Broadcasts and Streams to understand more how the broadcast work.

According to this guide, the stream enables you to transmit audio-video content to YouTube, and it defines the settings for how you stream your content to YouTube. The same stream can be bound to up to three live broadcasts.

So if you want to create many live broadcast, this guide Use one stream to create simultaneous broadcasts can help you to do it.

like image 42
KENdi Avatar answered Sep 22 '22 11:09

KENdi