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

查看:45
本文介绍了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 自己的使用图表),我仍然看到0% 使用"在配额标签.

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 调用进行身份验证,如果您使用您的项目 Simple API Key,您是以您自己的身份进行身份验证.如果同时使用,则调用失败.

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天全站免登陆