【发布时间】:2020-02-07 03:53:01
【问题描述】:
Google Drive API GET 查询开始失败(我们在我们的一个客户端服务中使用这个 api):
https://www.googleapis.com/drive/v3/files/1ke4Yoxxxxxxxxxxxxxx?alt=media&access_token=ya29.ImG9BwT.....
我们很抱歉... ...但您的计算机或网络可能正在发送自动查询。为了保护我们的用户,我们现在无法处理您的请求。 有关详细信息,请参阅 Google 帮助... “来自您的计算机网络的异常流量”
到今天为止一切都很好。
刚刚用 curl 做了几个测试:
- 在 HTTP 标头中带有 access_token 的 HTTP GET: curl -H "授权:承载 ya29._valid_access_token" https://www.googleapis.com/drive/v3/files/1r5BT2WPrulQ6FyhT8RcqV51TVOThEmhK?alt=media
结果:成功,文件下载。
- 带有 access_token 的 HTTP GET 作为 HTTP 请求的一部分: 卷曲https://www.googleapis.com/drive/v3/files/1r5BT2WPrulQ6FyhT8RcqV51TVOThEmhK?alt=media&access_token=ya29._valid_access_token
结果:错误
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
请注意,Google API 项目已获得 Google 批准并处于 Production 状态!!!
您好 Google 团队,您知道为什么会发生这种情况吗?
谢谢
【问题讨论】:
-
我认为您的问题的原因是由于this。很遗憾,
access_token的查询参数无法使用。所以请使用请求头的访问令牌而不是查询参数。 -
是的,就是这样。
-
是的,就是这样。不幸的是,Google 没有更新这些文档:developers.google.com/drive/api/v3/query-parameters 您可以通过以下两种方式之一为任何请求提供 OAuth 2.0 令牌: 1. 使用 access_token 查询参数,如下所示:?access_token=oauth2-token 2. 使用 HTTP像这样的授权标头: Authorization: Bearer oauth2-token
-
我投票决定将此问题作为题外话结束,因为它显然是 Google 支持的问题。
-
我在使用
googleapis时遇到了类似的问题,当我将包从 39 更新到 48 时,问题解决了。
标签: google-drive-api