在节点js中使用REST参考Google云端存储我在postman中得到了这个错误,我得到以下错误。 网址: https://datastore.googleapis.com/v1/projects/ {}专案编号:allocateIds Requset身体:GCP CLoudStore REST参考
{
"keys": [
{
"partitionId": {
"namespaceId": "default",
"projectId": "superb-watch-172816"
},
"path": [
{
"kind": "User50records"
}
]
}
]}
我得到这个错误:
{ "error": { "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } }
只是想addthatin命令,如果你不使用任何谷歌计算引擎或谷歌应用程序引擎,通过API使用GCS。有必要创建一个服务帐户,从那里你可以下载密钥在XML或JSON。如果您使用的是GAE或GCE,则可以像Brandon所述的那样创建API密钥或使用服务的默认凭证。 –
我试过用钥匙得到了同样的错误。 –
@VinodKumarMarupu - 您可能需要提供身份验证。快速测试这个方法是使用gcloud工具。运行'gcloud auth print-access-token'。将结果放入请求标题,如“Authorization:Bearer ya29.whateverxxxxxxxxxxxxxxxxxxxxxxx” –