Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Simple API key stopped working

I'm using Python/Twisted to do asynchronous HTTP calls to the Google+ API. Our client app passes over the user's access_token and we do an API call to...

https://www.googleapis.com/plus/v1/people/me/?%s&key=%s&

... where %s and %s are being filled with a valid access_token and (supposedly) valid Simple API Key, respectively.

Everything was working beautifully yesterday. Today I continued to work on the unit tests for this when the API suddenly started returning:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyInvalid",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

usageLimits, keyInvalid... Okay, I get it. I've seemingly hit the usage limits and they have invalidated API keys coming from this account. Except, I haven't...

The "Courtesy Limit" is supposed to be "10,000 requests/day", yet I've only made a couple hundred calls (according to Google's own usage graphs), and I am still seeing "0% used" on the quotas tab.

I would have brought this to Google directly, but they seem to have dropped their Developers Google Group in favor of a Google+ discussion that doesn't actually receive any responses.

Any help or guidance is extremely appreciated. Thanks!

like image 502
Tyler Morgan Avatar asked Jul 02 '13 22:07

Tyler Morgan


1 Answers

The answer was quite simple! You can't send both the access_token and the key in the same API call. If you use the access_token you're authenticating the API call as the user, if you use your projects Simple API Key you're authenticating as yourself. If you use both, the call fails.

like image 70
Tyler Morgan Avatar answered Nov 14 '22 02:11

Tyler Morgan