我正在使用api
搜索谷歌分析这是我的测试代码:
$client = new Google_Client();
$client->setApplicationName('xxx');
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . 'xxx.php');
$client->setAuthConfig("xxx.json");
$client->setAccessType('offline');
$client->setApprovalPrompt('force');
$client->addScope(Google_Service_Analytics::ANALYTICS_READONLY);
$client->setAccessToken($_SESSION["access_token"]);
try{
$analytics = new Google_Service_Analytics($client);
$accounts = $analytics->management_accounts->listManagementAccounts();
}catch(google_Service_Exception $e){
$e->getMessage();
print_r($e->getMessage());
}
结果是:
{"error":{"errors":[{"domain":"global","reason":"insufficientPermissions","message":"Insufficient Permission"}],"code":403,"message":"Insufficient Permission"}}
我使用Embed API来测试我的帐户权限是否正常,那么我不明白为什么?
任何人都可以告诉我需要在api控制台中为我的应用设置哪些权限。 ?非常感谢你。