Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API returning Access Not Configured

I thought this would be straight forward, but for some reason I'm getting hammered on this one.

I'm using PHP + CURL to try and retrieve a list of Web Fonts. The code is simple:

        $url = "https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key=MY_SERVER_APPS_KEY";

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        $google_response = curl_exec($ch);
        curl_close($ch);            

The code is hitting Google, but $google_response always returns:

"error": {
    "code": 403,
    "errors": [
        {
            "domain": "usageLimits",
            "reason": "accessNotConfigured",
            "message": "Access Not Configured"
        }
    ],
    "message": "Access Not Configured"
}

I've set up a server access key and put both of my web server's API keys on it. (To verify my IP, I did a WGET on curlmyip.com) I've also enabled the "Web Fonts Developer API" from the Services tab.

Is there anything I could be overlooking?

like image 542
Anthony Avatar asked Jan 15 '13 23:01

Anthony


3 Answers

I found the solution. Apparently I needed to register my server's IPv6 address, not the IPv4's. Worked without any code changes after adding them.

like image 187
Anthony Avatar answered Oct 31 '22 05:10

Anthony


In my case the needed API was not enabled.

To enable:

  1. Go to https://console.developers.google.com
  2. Click the menu icon in the top left
  3. Click API Manager from the menu
  4. Search for your API in the search bar (e.g. YouTube Data API v3) and click on it
  5. Once on the subpage for that API, click Enable in the top left
like image 14
Nelu Avatar answered Oct 31 '22 05:10

Nelu


remove all "allowed Ips", then Any IP allowed

like image 4
Baryon Lee Avatar answered Oct 31 '22 05:10

Baryon Lee