- Gcloud auth login Do not use that in production environments. Is there a way to get the active account without grep-ing and awk-ing? gcloud auth list is good for humans but not good enough to a machine. com; git config --global user. gcloud auth application-default login And then in the script just: storage_client = storage. com is displayed. json You should be now set, but if you want to use it as Application Default Credentials (ADC), that is in the context of other libraries and tools, you need to set the following environment variable to point to the key file: So, gcloud auth login -> Login to gcloud SDK. Share When I run gcloud auth list only the new corporate email <new_corporate_email>@domain. Another option that might make things even easier and takes care of these things automatically is using the gcloud cli tool. So, gcloud auth login -> Login to gcloud SDK. To activate your service account, run gcloud auth login with the --cred-file flag: gcloud auth login --cred-file=CONFIGURATION_OR_KEY_FILE. Alternatively, you can follow this doc to go through the OAuth consent screen and generate a client secret. Also the code might change in the future. Client() And it will get the credentials from the environment. If your application is running on one of the Google compute services, your app should be using the metadata service or an explicitly specified service account. gcloud config list account also shows me to verbose output: gcloud auth activate-service-account --key-file=MY_KEY_FILE. Replace CONFIGURATION_OR_KEY_FILE with the path to one of the following: A credential configuration file for workload identity federation; A service account key file Run gcloud auth activate-service-account --key-file <path to key file>. Here are the steps I took. If you look at the second option here under the How the Application Default Credentials work, you can find info on how to use it to manage the credentials for you ( gcloud auth login and gcloud auth application-default login ) Using gcloud auth you can add or remove accounts used during the gcloud commands. gcloud auth login; gcloud auth login --no-launch-browser; gcloud auth application-default login; gcloud config set account <new_corporate_email>@domain. json You should be now set, but if you want to use it as Application Default Credentials (ADC), that is in the context of other libraries and tools, you need to set the following environment variable to point to the key file:. However, this might now work on all systems. Note that Google Compute Engine VMs come with a slightly-different service account; the difference is described here . I want a cleaner solution. gcloud auth application-default login -> Login to any code running on the computer (language SDK's within an application) There is also a give-away in the OAuth authentication screen in the browser windows that open up: gcloud auth login is a developer command. email An easy solution that works for me is running the gcloud CLI with the environment variable DISPLAY='X': DISPLAY='X' gcloud auth application-default login You can also set an alias: alias gauth='DISPLAY="X" gcloud auth application-default login' Troubleshooting. bzpgfx tlvv vrpk glfyvig rfdxxj pwb jlwzk vzwuz aumlf ymqwcgb