Reputation: 781
I was following Firebase's documentation here: https://firebase.google.com/docs/storage/web/download-files
When I got to the part of installing gsutil and running this command afterwards:
set cors.json gs://images/
I received this error
AccessDeniedException: 403 does not have storage.buckets.get access to the Google Cloud Storage bucket
Upvotes: 3
Views: 6751
Reputation: 2612
This error is because the user that is authenticated for the gsutil command doesn't have the Storage admin Role in order to be able to modify the CORS configuration of the bucket.
As the documentation guides you on installing the full cloud SDK I will asume you have it and can use the commands on it.
gcloud auth login
Follow the instructions on screen.
gcloud projects list
gcloud projects add-iam-policy-binding <PROJECT-ID> --member='user:<USER_ACCOUNT>' --role='storage.admin'
The project ID you will get it from the first command.
Now you shall be able to run:
set cors.json gs://images/
Upvotes: 2