Google Simple API密钥停止工作 [英] Google Simple API key stopped working

查看:91
本文介绍了Google Simple API密钥停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python/Twisted对Google+ API进行异步HTTP调用.我们的客户端应用程序传递了用户的access_token,我们通过API调用...

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&

...,其中%s和%s分别用有效的access_token和(据说)有效的简单API密钥填充.

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

昨天一切工作都很好.今天,当API突然开始返回时,我继续为此进行单元测试:

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 ...好吧,我明白了.我似乎已达到使用限制,并且他们已使来自此帐户的API密钥无效.除了,我没有...

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...

礼貌限额"应该是每天10,000个请求",但是我只打了几百次电话(根据Google自己的使用情况图表),我仍然看到配额标签.

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.

我本可以直接将其提交给Google,但他们似乎放弃了Google开发者小组,转而支持Google+讨论,而实际上没有收到任何答复.

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!

推荐答案

答案很简单!您不能在同一API调用中同时发送access_token和密钥.如果您使用access_token,则要以用户身份验证API调用;如果您使用项目的简单API密钥,则要以您自己的身份进行验证.如果同时使用两者,则呼叫将失败.

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.

这篇关于Google Simple API密钥停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆