好的,因为标题提示了谷歌分析API问题......
现在在我开始之前,有一个管道重复......我已阅读
403 Insufficient permissions error while trying to get Google Analytics data
Analytics Google API Error 403: "User does not have any Google Analytics Account"
Google Analytics API: "User does not have sufficient permissions for this account."
仍然无法让它发挥作用。 我像这样添加了范围:
$client->addScope("https://www.googleapis.com/auth/analytics");
目前我有查看ID(个人资料)我正在尝试查询:46034120
所以我得到了服务
$this->service = new \Google_Service_Analytics($client);
我打电话:
$this->service->data_ga->get(
'ga:46034120',
'7daysAgo',
'today',
'ga:session');
至于一开始的问题,我确保可以从登录到Google的oAuth2.0系统的Google帐户访问此视图。因此用户有权访问此视图。我还确保将developer.google服务电子邮件地址添加到Google Analytics中,但仍无法使用。
SCOPE:
{
"issued_to": "140914874329-48n4vvp54irhf2j2hqieev32qukstc8e.apps.googleusercontent.com",
"audience": "140914874329-48n4vvp54irhf2j2hqieev32qukstc8e.apps.googleusercontent.com",
"user_id": "113401197174555518304",
"scope": "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/plus.moments.write https://www.googleapis.com/auth/plus.profile.agerange.read https://www.googleapis.com/auth/plus.profile.language.read https://www.googleapis.com/auth/plus.circles.members.read",
"expires_in": 3497,
"access_type": "offline"
}
答案 0 :(得分:1)
您可以通过调用
来检查授予的令牌 https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=accessToken
。
在那里,您可能会看到用户ID和授予的范围。如果您无权访问,则您的权限显然不足。