客户端中出现错误->;fetchAccessTokenWithAssertion()


Getting Error in client->fetchAccessTokenWithAssertion()

我想通过谷歌实时分析api获取GA数据。为此,我使用谷歌api php客户端。我正在遵循下面的教程。https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-php

我在client->fetchAccessTokenWithAssertion()中出错。此函数会出现以下错误。

PHP致命错误:未捕获异常"LogicException",消息为'config参数"signing_key"必须设置为使用刷新令牌中的断言/用户/CFDIN/Work/goocollectalytics/google-api-php-client/src/google/client.php:201

有人能告诉我为什么会出现这个错误吗?

根本原因是您的身份验证不正确,因此它没有在配置对象中生成signing_key。

我建议您的问题是client_secret.p12文件。

您确定此文件已正确填充,并且此处的路径正确吗?

$key_file_location = '<Replace with /path/to/generated/client_secrets.p12>';