[英]google-api-php-client apiAuthException refreshing OAuth2
I'm developing a PHP script to display a page with some charts and stats about my Analytics profile. 我正在开发一个PHP脚本来显示一个页面,其中包含有关我的Google Analytics(分析)配置文件的一些图表和统计信息。 I'm sending 3 or 4 ajax asynchronous calls to the server; 我正在向服务器发送3或4个ajax异步调用; the server then fetch data using google-api-php-client . 然后服务器使用google-api-php-client获取数据。 There are about 10 requests to Google for each page refresh. 每次刷新页面都会向Google发送约10个请求。
The problem is i'm getting totally random exceptions from the api: 问题是我从api获得了完全随机的异常:
Fatal error: Uncaught exception 'apiAuthException' with message 'Error refreshing the OAuth2 token, message: ' in apiOAuth2.php on line 242 致命错误:242行上的apiOAuth2.php中出现消息“刷新OAuth2令牌时出错,消息:”的未捕获异常'apiAuthException'
One time i successfully get the data, one time not. 一次我成功获取数据,一次没有。 This is very annoying because i cannot find why . 这很烦人,因为我找不到原因 。 What could be? 可能是什么? The asynch calls maybe? 发出紧急电话吗?
User quota is set to 1000 requests/second just to be sure. 只是为了确保将用户配额设置为1000个请求/秒。 Eventually i get 'User quota exceded' from the api, something quite impossible. 最终,我从api中获得了“用户配额超出限制”,这是完全不可能的。
I answer to myself because i found the problem (was my bad): 我回答自己,因为我发现了问题(是我的不好):
__destruct()
method of my wrapper class) and used for the next request (i was not saving it!) 新的访问令牌应再次保存到文件中(我将其保存到包装类的__destruct()
方法中)并用于下一个请求(我没有保存它!)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.