AccessDeniedException:403 没有 storage.buckets.get 访问 Google Cloud Storage 存储桶
AccessDeniedException: 403 does not have storage.buckets.get access to the Google Cloud Storage bucket
我在这里关注 Firebase 的文档:https://firebase.google.com/docs/storage/web/download-files
当我开始安装 gsutil 和 运行 这个命令之后:
set cors.json gs://images/
我收到这个错误
AccessDeniedException: 403 does not have storage.buckets.get access to the Google Cloud Storage bucket
此错误是因为针对 gsutil 命令进行身份验证的用户没有存储管理员角色,无法修改存储桶的 CORS 配置。
作为 documentation guides you on installing the full cloud SDK 我会假设你有它并且可以使用它上面的命令。
- 首先您需要使用以下命令登录:
gcloud auth login
按照屏幕上的说明进行操作。
- 登录后,您需要在您的帐户中拥有存储管理员角色,为此您需要知道您的 Project-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/
我在这里关注 Firebase 的文档:https://firebase.google.com/docs/storage/web/download-files
当我开始安装 gsutil 和 运行 这个命令之后:
set cors.json gs://images/
我收到这个错误
AccessDeniedException: 403 does not have storage.buckets.get access to the Google Cloud Storage bucket
此错误是因为针对 gsutil 命令进行身份验证的用户没有存储管理员角色,无法修改存储桶的 CORS 配置。
作为 documentation guides you on installing the full cloud SDK 我会假设你有它并且可以使用它上面的命令。
- 首先您需要使用以下命令登录:
gcloud auth login
按照屏幕上的说明进行操作。
- 登录后,您需要在您的帐户中拥有存储管理员角色,为此您需要知道您的 Project-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/