如何匿名访问Firebase Storage?

时间:2019-06-09 07:42:42

标签: c# firebase firebase-storage firebase-security-rules

我正试图在没有任何凭据的情况下访问Firebase Storage中的文件。

正如文档所述,这些规则允许所有人访问。

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

但是我遇到了错误:

Anonymous caller does not have storage.objects.list access to bucket_name. [401]
Errors [
    Message[Anonymous caller does not have storage.objects.list access to bucket_name.] Location[Authorization - header] Reason[required] Domain[global]
]

我同时尝试了Cloud Storage SDK for .NET和将Web请求定向到JSON API

var storage = StorageClient.CreateUnauthenticated();
var objects = await storage.ListObjectsAsync("bucket_name", "prefix").ToList();
curl \
  'https://www.googleapis.com/storage/v1/b/bucket_name/o?key=api_key' \
  --header 'Accept: application/json' \
  --compressed

我想念了什么或我做错了什么?

0 个答案:

没有答案