Reputation: 3968
To get my ADC(application default configuration) for gcloud, I must run:
$ gcloud auth application-default login
However, it spits out a link that it tells my browser to visit(which I can't due to permission restrictions at work).
I read through the man pages, and I saw there was a flag called --no-launch-browser
. I tried it, and it still told me to go to a link in my browser, followed by a verification code. That's a bit of a misnomer, isn't it?
So what can I do so I can actually access my gcloud ADC?
Upvotes: 9
Views: 12242
Reputation: 4199
Alternative way:
Download service JSON file.
Execute command:
gcloud auth login --cred-file=YOUR_CONFIGURATION_OR_KEY_FILE
It will authenticate without any browser.
Upvotes: 1
Reputation: 1516
The browser is launched only if the DISPLAY
variable is set; if not, the gcloud auth application-default login
command prints a URL to standard output to be copied. The printing of the URL to the standard output can be secured in any case, if the --no-launch-browser
flag is set.
You are supposed to use the URL in a browser of your choice, to get the verification code to be provided to the "Enter verification code:" prompt.
Upvotes: 9
Reputation: 29591
Your only option is a service account. Using curl or wget might also be an option depending on what prevents you from using a web browser.
Upvotes: 0