Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gcloud auth login saves to legacy_credentials folder

I have no idea why, but I am running gcloud auth login, I have tried beta and application-default. All of them do not create the file: ~/.config/gcloud/credentials, instead I can find ~/.config/gcloud/legacy_credentials.

The issue I am having is that the library I am using does not want legacy_credentials, and renaming the folder did not work.

Here are my settings:

Google Cloud SDK 183.0.0
alpha 20
17.12.08
beta 2017.12.08
bq 2.0.27
core 2017.12.08
gsutil 4.28

Also I am using Ubuntu 16.04.3 LTS on digitalocean. I will be glad to supply any other information I can think of.

The credentials in the legacy folder contain:

" ============================================================================
" Netrw Directory Listing                                        (netrw v155)
"   /root/.config/gcloud/legacy_credentials/[email protected]
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special
" ==============================================================================
../                                                                                                                                                                                       
./
.boto
adc.json
like image 306
msj121 Avatar asked Sep 13 '25 09:09

msj121


1 Answers

gcloud no longer uses ~/.config/gcloud/credentials, instead it stores credentials in sqlite3 ~/.config/gcloud/credentials.db.

These credentials files are considered internal to gcloud, they can change at any time. You should not be using them. What you likely want to use is

gcloud auth application-default login

instead of gcloud auth login. The former will create ~/.config/gcloud/application_default_credentials.json key file for user logged in account.

That said depending what you trying to do you probably want use service accounts (instead of user account). You can create the key file via

gcloud iam service-accounts keys create

See documentation for more info. Or you can use Google Cloud Platform Console to create key file.

Once you obtain json key file you can use it in your application as application default credentials, see https://developers.google.com/identity/protocols/application-default-credentials#howtheywork

You can also use this key in gcloud by using gcloud auth activate-service-account command.

like image 164
cherba Avatar answered Sep 16 '25 07:09

cherba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!