Firebase存储– 403权限不足

时间:2019-01-29 23:52:33

标签: firebase firebase-storage

我正在尝试使用cURL作为概念证明将文件上传到Firebase存储。我已为该项目启用了Google Cloud Storage JSON API。

我使用了一些Apps脚本来获取OAuth访问令牌:

var accessToken = ScriptApp.getOAuthToken();
Logger.log(accessToken);

我正在尝试使用cURL将文件上传到Firebase存储桶,其中包括我生成的访问令牌:

curl --request POST \
     --data-binary "@myfile.json" \
     -H "Authorization: Bearer ya29..." \
     https://www.googleapis.com/upload/storage/v1/b/mybucket.appspot.com/o?uploadType=media

但是响应始终是:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "insufficientPermissions",
    "message": "Insufficient Permission"
   }
  ],
  "code": 403,
  "message": "Insufficient Permission"
 }
}

存储桶上的权限是:

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write;
    }
  }
}

这应该允许公众访问,一旦文件上传,我将加强收紧工作。

我想念什么?

0 个答案:

没有答案
相关问题