2016-11-04 101 views
0

我收到以下例外(403)訪問未配置。 Google Cloud Datastore API

Google_Service_Exception:調用POST的錯誤https://www.googleapis.com/datastore/v1beta2/datasets/smartflowviewer/lookup:(403)Access Not Configured。 Google Cloud Datastore API尚未在項目529103574478中使用過,或者被禁用。通過訪問https://console.developers.google.com/apis/api/datastore/overview?project=529103574478啓用它,然後重試。如果您最近啓用了此API,請等待幾分鐘,以便將操作傳播到我們的系統並重試。

試圖訪問數據存儲

$service = new Google_Service_Datastore($client); 
$service_dataset = $service->datasets; 

$path = new Google_Service_Datastore_KeyPathElement(); 
$path->setKind('auth'); 
$path->setName($email); 
$key = new Google_Service_Datastore_Key(); 
$key->setPath([$path]); 
$lookup_req = new Google_Service_Datastore_LookupRequest(); 
$lookup_req->setKeys([$key]); 

$response = $service_dataset->lookup('smartflowviewer', $lookup_req); 

我使用OAuth的Web客戶端API

$client = new Google_Client(); 
$client->setClientId($cfg['CLIENT_ID']); 
$client->setClientSecret($cfg['CLIENT_SECRET']); 
$client->setAccessType('offline'); 

該項目一直在努力完全正常,直到昨天上班。我沒有在最近一個月內部署任何新代碼或更改任何設置。突然它開始拋出這個錯誤。

什麼可能會導致此行爲的任何想法?非常感謝。

回答

2

Cloud Datastore v1beta2 API爲deprecated,但您可以更新代碼以使用Cloud Datastore v1 API。

一種選擇是查看php-gds庫。

+0

非常感謝。我已經轉移到最新版本。它現在有效。 –

相關問題