15
votes

I created a Google application in the developers console, turned on "YouTube Data API v3", generated the server API key, and authorized my home and work IPs.

My website lists all videos from a Youtube channel, using the V3 API. It uses the official PHP library, passing it the server API key.

It all worked well yesterday from home, and today morning from work. Then, it suddently stoped working at 11am (GMT+1), with no action from my part, with this error:

[Google_Service_Exception] Error calling GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=xxxxxxxxxx&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: (403) Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your APIkey and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.

Note: i used less than 10 requests, out of the 50 millions allowed by day, i have a static public IP address, this part of the code was untouched.

What can i look for in order to fix that, please? I really don't know where to head for from now... Thank you.

7

7 Answers

30
votes

Oooook...

Do all you have to with the API activations before you generate any keys!

Unactivating or reactivating API (like "Youtube Data") silently destroys your key validity. At least for the server one.

So the solution is, when you get the same error as me:

  • destroy your server key (delete it completely, do not only regenerate)
  • deactivate then reactivate all APIs you need
  • create a new server key
  • thank Google for the so clear error messages (optional)
7
votes

Additionnaly when I opened the requested URL in browser I found that the API call returned

{"domain": "usageLimits"}

I tried the above solutions without success.

Creating a new project from scratch solved the issue

Thanks @Danra, you helped, but I add this answer because your comment is default hidden.

6
votes

This solved for me.... i first followed @Ninj answer...still no change. Then, After adding my domain urls to 'allowed referers' list, i regenerated the key alone it then worked like a charm !

i guess google parses allowed urls from the key string itself, not from updated settings

6
votes

I got frustrated and created a new project with a new key and it worked like a charm.

1
votes

Solution 1: Create new project and enable Youtube Data v3 api and create credential.

Solution 2: Check limit Quota in Youtube Data v3 -> Quota (in left pane) & Increase the limits per day or request for Higher Quota

1
votes

I also tried everything, but could only solve this when I created a new project, gave access to the APIs I needed, and added a new key.

I also got a "Bad Request" error and this solved it.

1
votes

I also tried everything, but could only solve this when I created a new project, gave access to the APIs I needed, and added a new key.