Node.js GCP CLoudStore REST参考

Node.js GCP CLoudStore REST参考,node.js,google-cloud-datastore,google-cloud-storage,google-api-nodejs-client,gcp,Node.js,Google Cloud Datastore,Google Cloud Storage,Google Api Nodejs Client,Gcp,在node js Google cloud store中使用REST引用,我在postman中得到了这个错误,我得到了以下错误。 网址: {projectId}:分配ID 请求正文: { "keys": [ { "partitionId": { "namespaceId": "default", "projectId": "superb-watch-172816" }, "path": [ { "kind": "User50records"

在node js Google cloud store中使用REST引用,我在postman中得到了这个错误,我得到了以下错误。 网址: {projectId}:分配ID 请求正文:

 {
"keys": [
{
  "partitionId": {
    "namespaceId": "default",
    "projectId": "superb-watch-172816"
  },
  "path": [
    {
      "kind": "User50records"
    }
  ]
}
]}
我得到了这个错误:

{
“错误”:{
“代码”:401,
“消息”:“请求缺少所需的身份验证凭据。应为OAuth 2访问令牌、登录cookie或其他有效身份验证凭据。请参阅。”https://developers.google.com/identity/sign-in/web/devconsole-project.",
“状态”:“未经验证”
}

}

不允许对云数据存储进行真正的匿名调用。您必须以某种方式向服务器标识自己。最基本的要求是附加一个API密钥,这基本上就是声称您与某个项目或其他项目有关联。如果您正在访问任何人都无法公开查看的数据,您还需要提供某种身份验证,这通常是通过OAuth完成的

因此,假设这是公共数据,则工作量最小:get,然后将“key=myKey”查询参数附加到URL


认证指南:

如果您既不使用Google Compute Engine也不使用Google App Engine,那么为了通过API使用GCS,只想添加这一点。有必要创建一个服务帐户,从那里可以下载XML或JSON格式的密钥。如果您使用的是GAE或GCE,则可以按照Brandon的说明创建API密钥,或者使用服务的默认凭据。@Vinodkumararupu-您可能需要提供身份验证。测试这一点的快速方法是使用gcloud工具。运行
gcloud auth print access token
。将结果放入请求头中,如“Authorization:Bearer ya29.whateverxxxxxxxxxxxxxxxxxxxxxxxx”@BrandonYarbrough让它为我工作,在运行api时,我得到了数据{“batch”:{“entityResultType”:“PROJECTION”,“endCursor”:“CgA=,“moreResults”:“NO_MORE_results”}如何查看实体中的实际数据?@Nilo\u DS是正确的。您需要从GoogleAPI控制台设置一个服务帐户,并使用其凭据通过云数据存储RESTAPI进行身份验证。这里有一个关于设置服务帐户的指南链接:@BrandonYarbrough你能在这里帮忙吗