【问题标题】:AccessDeniedException: 403 does not have storage.buckets.get access to the Google Cloud Storage bucketAccessDeniedException: 403 没有 storage.buckets.get 访问 Google Cloud Storage 存储桶的权限
【发布时间】:2020-12-03 18:16:11
【问题描述】:

我在这里关注 Firebase 的文档:https://firebase.google.com/docs/storage/web/download-files

当我开始安装 gsutil 并随后运行此命令时:

set cors.json gs://images/

我收到了这个错误

AccessDeniedException: 403 没有 storage.buckets.get 访问 Google Cloud Storage 存储桶的权限

【问题讨论】:

    标签: firebase google-cloud-storage firebase-storage gsutil


    【解决方案1】:

    此错误是因为通过 gsutil 命令验证的用户没有存储管理员角色,无法修改存储桶的 CORS 配置。

    作为documentation guides you on installing the full cloud SDK,我假设你拥有它并且可以使用它上面的命令。

    • 首先您需要使用以下命令登录:
    gcloud auth login
    

    按照屏幕上的说明进行操作。

    • 登录后,您需要在帐户中拥有存储管理员角色,为此您需要知道您的项目 ID,然后授予权限。所以需要运行以下两个命令:
    gcloud projects list
    
    gcloud projects add-iam-policy-binding <PROJECT-ID> --member='user:<USER_ACCOUNT>' --role='storage.admin'
    

    您将从第一个命令中获得的项目 ID。

    现在你应该可以运行了:

    set cors.json gs://images/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-21
      • 2020-11-17
      • 2020-11-11
      • 2021-05-01
      • 2019-10-12
      • 1970-01-01
      • 2013-11-15
      • 1970-01-01
      相关资源
      最近更新 更多