0
votes

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

1

1 Answers

2
votes

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.

  • First you need to login for this use the following command:
gcloud auth login

Follow the instructions on screen.

  • Once loged in you would need to have Storage admin role in your account, for this you will need to know your Project-id and then grant the permission. So will need to run the following two commands:
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/