我正在尝试使用云数据存储 - 我创建了一个 appengine 项目,可以在https://cloud.google.com/console#/上查看。
通过云控制台,我导航到 API,然后关闭并重新打开数据存储 API。然后我注册了一个应用程序(Web 应用程序,通用)并生成了一个证书。我已确保由此生成的电子邮件位于具有“可以编辑”权限的“团队”列表中。
毕竟,我生成的任何请求都返回 403。对其他 API 的请求,例如预测 API,工作正常。数据存储从我的代码库(使用 php api)或 api explorer 返回 403。
下面是从 PHP 客户端生成的 HTTP 请求的转储。任何帮助将不胜感激!
object(Google_HttpRequest)[15]
private 'batchHeaders' =>
array (size=4)
'Content-Type' => string 'application/http' (length=16)
'Content-Transfer-Encoding' => string 'binary' (length=6)
'MIME-Version' => string '1.0' (length=3)
'Content-Length' => string '' (length=0)
protected 'url' => string 'https://www.googleapis.com/datastore/v1beta1/datasets/madlab-sandbox/lookup' (length=75)
protected 'requestMethod' => string 'POST' (length=4)
protected 'requestHeaders' =>
array (size=3)
'content-type' => string 'application/json; charset=UTF-8' (length=31)
'content-length' => int 62
'authorization' => string 'Bearer ya29.AHES6ZSfJmWHLNIrPwQA7wZ3miGCMgxvmUmYl65mfw9J2_v8KgmLMyJV' (length=68)
protected 'postBody' => string '{"keys":[{"path":[{"id":"5629499534213120","kind":"topic"}]}]}' (length=62)
protected 'userAgent' => string 'test google-api-php-client/0.6.4' (length=32)
protected 'responseHttpCode' => int 403
protected 'responseHeaders' =>
array (size=9)
'content-type' => string 'application/json; charset=UTF-8' (length=31)
'date' => string 'Fri, 26 Jul 2013 15:26:13 GMT' (length=29)
'expires' => string 'Fri, 26 Jul 2013 15:26:13 GMT' (length=29)
'cache-control' => string 'private, max-age=0' (length=18)
'x-content-type-options' => string 'nosniff' (length=7)
'x-frame-options' => string 'SAMEORIGIN' (length=10)
'x-xss-protection' => string '1; mode=block' (length=13)
'server' => string 'GSE' (length=3)
'transfer-encoding' => string 'chunked' (length=7)
protected 'responseBody' => string '{
"error": {
"errors": [
{
"domain": "global",
"reason": "PERMISSION_DENIED",
"message": "Unauthorized."
}
],
"code": 403,
"message": "Unauthorized."
}
}
' (length=182)
public 'accessKey' => null