When making a request to:
https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=5&key=<MY_API_KEY>&q=dogs
I get the following error response:
"error": {
"code": 403,
"message": "Requests from referer \u003cempty\u003e are blocked.",
"errors": [
{
"message": "Requests from referer \u003cempty\u003e are blocked.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_HTTP_REFERRER_BLOCKED",
"domain": "googleapis.com",
"metadata": {
"consumer": "projects/119952101582",
"service": "youtube.googleapis.com"
}
}
]
}
}
I just had the same issue. In my case I had to explicitly set the referer cURL option. I was using PHP + cURL, but there is probably an equivalent for your setup. I was scratching my head that it was empty as well and not derived by Google when it received the request. So for me I added this to my cURL request:
curl_setopt($curl, CURLOPT_REFERER, "https://www.myexamplewebsite.com/");
So in the Google API restriction console, you would have something like this:
https://www.myexamplewebsite.com/*
Hope this helps in your scenario.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With