DEV Community

Ifeanyi Chima
Ifeanyi Chima

Posted on

Google Cloud Auth Issue

Copying file://kitten.png [Content-Type=image/png]... ServiceException: 401 Anonymous caller does not have storage.objects.create access to the Google Cloud Storage object. Permission 'storage.objects.create' denied on resource (or it may not exist).

Enter fullscreen mode Exit fullscreen mode

Steps to recreate it.

Having this issue while trying to copy a file to a new cloud storage bucket.

  1. Download a cat image This will download the image for us.
wget https://cloud.google.com/storage/images/kitten.png

Enter fullscreen mode Exit fullscreen mode
  1. Try to copy the image to my cloud storage bucket
gsutil cp kitten.png gs://gcp-ifeanyi-tutorial

Enter fullscreen mode Exit fullscreen mode

Now, we run into the issue stated above.

Steps to Resolve

gcloud auth login

Enter fullscreen mode Exit fullscreen mode
  1. Follow the prompt (Type Y for yes)
  2. Copy the link provided in your browser
  3. Select your google account and grant permission

After following the prompt you will be provided with a key that looks like this
4/9ANIR-c9k6BnlT ..........

  1. Copy the key and paste it in your google cloud console
  2. Try to run the previous command again
gsutil cp kitten.png gs://gcp-ifeanyi-tutorial

Enter fullscreen mode Exit fullscreen mode

Top comments (0)