我在这里关注Firebase的文档:https://firebase.google.com/docs/storage/web/download-files
当我开始安装gsutil并随后运行此命令时:
set cors.json gs://images/
我收到此错误
AccessDeniedException:403没有storage.buckets.get访问Google Cloud Storage存储桶
答案 0 :(得分:2)
此错误是因为通过gsutil命令认证的用户没有存储管理员角色,以便能够修改存储桶的CORS配置。
作为documentation guides you on installing the full cloud SDK,我假设您已经拥有并可以使用其中的命令。
gcloud auth login
按照屏幕上的说明进行操作。
gcloud projects list
gcloud projects add-iam-policy-binding <PROJECT-ID> --member='user:<USER_ACCOUNT>' --role='storage.admin'
您将从第一个命令获取的项目ID。
现在您将能够运行:
set cors.json gs://images/