我使用服务帐户验证了对Core Reporting的简单get请求。但回应总是:
{"error":{"errors": [{"message":"Forbidden"}],"code":403,"message":"Forbidden"}}当我通过“”(OAuth 2.0 Playground)对同一个api请求进行身份验证时,我可以毫无问题地获得api响应。所以问题不在api查询中。
我就是这样做的:
authorization: Bearer {access_token}。但我总是得了403号。--下面是iam所做工作的简短代码片段:
$client = new apiClient();
$client->setAssertionCredentials(new apiAssertionCredentials(
'{my_service_account_email}',
array('https://www.googleapis.com/auth/analytics.readonly'),
'{my_service_account_certificate}'
));
$request = $client->getIo()->authenticatedRequest(new apiHttpRequest('https://www.googleapis.com/analytics/v3/data/ga?{my_query}'));我做错什么了?
发布于 2012-08-20 13:11:12
对于那些仍在寻求答案的人来说,这可能是有用的。
你需要将你的client_id连接到你的Google帐户,一些说明说明可以在http://www.pimcore.org/wiki/display/PIMCORE/Setup+Google+Analytics+Reporting+with+OAuth2+Service+Accounts+(since+1.4.6找到
https://stackoverflow.com/questions/9910776
复制相似问题