I’m working on a project where I’m using the YouTube Data API v3 to retrieve channel data. However, I’m encountering an error when making a request:
{"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/480613114246","service": "youtube.googleapis.com" } } ] }}I’ve set up my YouTube API key in the Google Cloud Console with referer restrictions to allow requests only from the following domains:
https://www.spacetiger.me/https://space-tiger-tarot-db.vercel.app/http://localhost:5173/ http://localhost:5173/* https://www.spacetiger.me/ https://www.spacetiger.me/* space-tiger-tarot-db.vercel.app spacetiger.me/ spacetiger.me/*But I’m still getting the error mentioned, and I’m not sure what’s causing it. I’ve checked the following:
1- The URLs I’ve set are correct and match the domains from where I’m making the requests.2- I’ve made sure the requests are coming from the correct domains using https://.Has anyone encountered a similar issue or have any suggestions on what could be causing this error? I would really appreciate any help or advice on how to resolve it.
It’s one of my first projects, I’m using React + Vite and deployed it to Vercel. I set up the API a few hours ago, and it was working fine, but suddenly it stopped working. I can't find any related errors in the Google Cloud console. The API key is in my .env file and in the environment variables on Vercel. I don't see anywhere that says my API key is blocked or disabled. I restricted the API to work with YouTube Data API v3.
Thanks!