带有"请求的Google Analytics Reporting API V4具有无效的身份验证凭据"

时间:2016-10-18 08:14:27

标签: php google-analytics-api google-api-php-client service-accounts

我们使用此步骤来设置我们的工具。 Hello Analytics Reporting API V4; PHP quickstart for service accounts

以下是演练https://advertisebg.com/report1610/GA/HelloAnalytics.php中的示例,代码与示例中的完全相同

  

致命错误:未捕获Google_Service_Exception:{"错误":{"代码":   401," message":"请求具有无效的身份验证凭据。",   "错误":[{" message":"请求有无效的身份验证   凭证。","域":"全球","原因":"未授权" }],   " status":" UNAUTHENTICATED"在...中   /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php:118   堆栈跟踪:#0   /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php(94):   Google_Http_REST :: decodeHttpResponse(对象(GuzzleHttp \ PSR7 \响应),   对象(GuzzleHttp \ Psr7 \ Request),' Google_Service _...')#1   /home/advbg/public_html/report1610/GA/src/Google/Task/Runner.php(181):   Google_Http_REST :: doExecute(对象(GuzzleHttp \客户端),   对象(GuzzleHttp \ Psr7 \ Request),' Google_Service _...')#2   /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php(58):   Google_Task_Runner-> run()#3   /home/advbg/public_html/report1610/GA/src/Google/Client.php(782):   Google_Http_REST :: execute(Object(GuzzleHttp \ Client),in   /home/advbg/public_html/report1610/GA/src/Google/Http/REST.php上线   118

几个小时没有任何问题,我们收到以下错误“请求有无效的身份验证凭据”

我们多次重新启动新项目,重新创建凭证,安装新示例,每次都是相同的结果,在工作了几个小时后,我们看到上面的错误。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

看起来这可能是Google PHP客户端库的一个问题,目前论坛上存在一个问题。

Sporadic "Invalid Credentials" Issues - Service Account

客户端库应该为您的接缝刷新身份验证。可能值得关注这个问题。