'Grant your originating account the Service Account Token Creator role on the target service account

I used the below command to Authenticate in MAC OS terminal

gcloud auth login

It redirects to the google login page and show the authentication process successful.

While using the command

gsutil -i [email protected] ls

Getting an exception as

AccessDeniedException: Service account impersonation failed. Please go to the Google Cloud Platform Console (https://cloud.google.com/console), select IAM & admin, then Service Accounts, and grant your originating account the Service Account Token Creator role on the target service account.

However, on the cloud I do have given the permission as shown below

enter image description here

enter image description here

Auth List

enter image description here



Solution 1:[1]

The current logged in user ([email protected]) must have the Service Account Access Token Creator role.

You might think the owner role would be sufficient, however, when I tested this myself you need to explicitly add it to the account that is impersonating the service account.

enter image description here

https://cloud.google.com/iam/docs/service-accounts#token-creator-role

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ThdK