x43
x43

Reputation: 316

YouTube embed API: The caller does not have permission

I'm embedding some YouTube videos on my website. I've been getting a few complaints that they don't load up. I investigated and noticed that when attempting to play them, I get a few 403 Forbidden errors:

403

Taking a look at the JSON response I get a few messages that generally say "The caller does not have permission". Here is the full JSON data:

{
    "error": {
        "code": 403,
        "message": "The caller does not have permission",
        "errors": [
            {
                "message": "The caller does not have permission",
                "domain": "global",
                "reason": "forbidden"
            }
        ],
        "status": "PERMISSION_DENIED"
    }
}

Why is this happening? I didn't think I needed a key or token to embed YouTube videos. What is the cause of this? Has my IP addresses been banned from a Google API?

For reference, the ID of the video I tried to load was Sq9kl3ybqY0.

Upvotes: 2

Views: 2502

Answers (1)

Ankush Chavan
Ankush Chavan

Reputation: 1184

One fix will be to replace the URL from youtube with the embed URL. Eg. If you have used a URL like youtube.com/watch?v=VIDEO_ID then replace it with the embed URL like youtube.com/embed/VIDEO_ID

Generally, this error occurs when your embed is initially hidden. In this case, just add ?html5=1 to embed the URL.

Upvotes: 1

Related Questions