当我jspm install在Aurelia项目中运行JS依赖项时,jspm说Github rate limit reached
怎么修?
在向 GitHub API 发出一些 HTTP 请求后,它开始拒绝调用,并显示:
xxx.xxx.xxx.xxx 超出 API 速率限制。(但好消息是:经过身份验证的请求可以获得更高的速率限制。请查看文档以了解更多详细信息。)
现在,有一种方法可以提高 OAuth 应用程序的未经身份验证的速率限制,其中涉及使用client secret.
当然,我们不想将或放在client secret前端应用程序的公共源代码上,正如文档所建议的那样:
注意:切勿与任何人分享您的客户端密钥或将其包含在客户端浏览器代码中。仅将此处显示的方法用于服务器到服务器的调用。
所以我想知道解决前端应用程序中速率限制问题的最佳方法是什么。
我正在构建一个可获取问题并提取超过1K github存储库请求的应用程序,就像这样。
$ curl -i "https://api.github.com/repos/user/repo/issues?state=closed"
Run Code Online (Sandbox Code Playgroud)
我的问题是,在最初的60次迭代之后,我遇到了速率限制错误:
{
"message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
Run Code Online (Sandbox Code Playgroud)
该文件说,我可以使用高达5000个请求验证这一点我注册了一个OAuth并获得Client ID和Client Secret令牌
https://api.github.com/repos/{repo.name}/issues?client_id=...&client_secret=...
速率限制仍然仅在大约60个请求后才会显示。