我正在开发一个PHP脚本,可以自动将PDF文档上传到Google Cloud 端桶 .

我正在使用Google的 Cloud 存储服务帐户 .

我得到的结果是:错误调用GET https://www.googleapis.com/storage/v1beta1/b/ .. :( 403)访问未配置

我正在使用的PHP代码(php google api client lib)如下:

$clientID = 'MY CLIENT ID';
$keyFile = 'PATH\TO\KEYFILE\key.p12';
$key_secret = 'MY KEY SECRET';

$client = new Google_Client();
$client->setClientId($clientID);
$client->setApplicationName("Google Cloud Storage Sample");
$client->setScopes('https://www.googleapis.com/auth/devstorage.full_control');

$key = file_get_contents($keyFile);
$client->setAssertionCredentials(new Google_AssertionCredentials(
    'service account name',
    array('https://www.googleapis.com/auth/devstorage.full_control'),
    $key,$key_secret)
);

$storageService = new Google_StorageService($client);
try 
{
   $bucket = $storageService->buckets->get('my_bucket');


}      
catch (exception $e)
{
    print $e->getMessage();
}


Thanks for any support on this one.