15

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.

Ninj
  • 1,492
  • 1
  • 15
  • 27

7 Answers7

30

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)
Ninj
  • 1,492
  • 1
  • 15
  • 27
  • Ha, thanks Google (sarcastically) but thank you (seriously) because I have not seen this documented anywhere else. – Michael Feb 02 '15 at 14:58
  • Didn't work for me despite multiple attempts - nothing brought the daily requests quota up from zero, so the API requests kept failing. I had to create a completely new project (see link in comment on OP above by @Memonic). – Danra Mar 20 '19 at 10:24
  • 7
    This happens with Google's apis everywhere. You always need to "do it first, then do this and then do that", which is not documented in the related docs. No one would be able to use Google's apis if not for stackoverflow – Ozgur Akcali Apr 02 '19 at 13:14
  • 1
    I clearly have the same problem, but this solution did not work for me as of 2019. Another SO solution suggests deleting the project and starting over (https://stackoverflow.com/a/54137521/943435). Google could have done better with the design and documentation. – Yogi Nov 14 '19 at 20:23
7

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.

migli
  • 2,692
  • 27
  • 32
6

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

Ananth
  • 1,798
  • 2
  • 11
  • 8
  • 4
    I did everything Ninj and you wrote. Actually I did in in a fresh new account, etc. Nothing helped. Seriously... How the !%=+!= this can happen still almost in 2019? Any solution? Help, please... – err Dec 27 '18 at 00:24
  • @err You are not alone. – Anon Dec 30 '18 at 05:29
  • This has not worked for me, I've tried this so many times for access through browser with javascript. – sayayin Mar 09 '19 at 19:51
  • 1
    The only thing which worked for me was creating a new project from scratch (see @Memonic's comment on OP above). – Danra Mar 20 '19 at 10:25
  • This problem is still actual in 2020.... The only thing that works for me was to create a new project and activating the YouTube Data API v3 again. So frustrating! – CodeWhisperer Jan 09 '20 at 09:58
6

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

Prabin Deka
  • 301
  • 3
  • 7
  • 2019-08-26 I had to create a new project as well. I had been using my old project for over a year. No idea why it stopped working. – user3220892 Aug 26 '19 at 19:28
  • 1
    Jesus, tried 3 hours to generate new credentials and stuff and this frckn sht worked. Thank you! – Mike Apr 29 '20 at 11:02
1

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

vaasav kumar
  • 166
  • 1
  • 4
  • Just as a side note - I seem to be getting this issue as I don't have billing attached to my project. My daily limit is set to 0 because of this. – scgough Feb 04 '20 at 00:26
1

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.

kintsukuroi
  • 1,332
  • 16
  • 15
1

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.