在節點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」 –