【问题标题】:(403) Access Not Configured. Google Cloud Datastore API(403) 未配置访问。谷歌云数据存储 API
【发布时间】:2017-03-18 18:42:13
【问题描述】:

我收到以下异常

Google_Service_Exception:调用 POST https://www.googleapis.com/datastore/v1beta2/datasets/smartflowviewer/lookup 时出错:(403) 未配置访问。 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');

直到昨天,该项目一直运行良好。在最近一个月内,我没有部署任何新代码或更改任何设置。突然它开始抛出这个错误。

有什么可能导致这种行为的想法吗?非常感谢。

【问题讨论】:

    标签: api google-app-engine google-cloud-datastore


    【解决方案1】:

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

    一种选择是查看php-gds 库。

    【讨论】:

    • 非常感谢。我已移至最新版本。现在可以了。
    猜你喜欢
    • 1970-01-01
    • 2013-04-30
    • 2012-08-06
    • 1970-01-01
    • 2017-11-23
    • 2014-08-11
    • 2019-08-24
    • 2017-09-06
    • 1970-01-01
    相关资源
    最近更新 更多