Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to Authenticate Application Default Credentials

I am following the docs here and it says:

The simplest way for applications to authenticate to a Google Cloud Platform API service is by using Application Default Credentials (ADC). Services using ADC first search for credentials within a GOOGLE_APPLICATION_CREDENTIALS environment variable; Google Cloud recommends you set this environment variable to point to your service account key file (the .json file downloaded when you created a service account key, as explained in Set Up a Service Account.

And it says to use this command:

$ export GOOGLE_APPLICATION_CREDENTIALS=<path_to_service_account_file>

In the Google Shell, I have attempted this:

<INSERT_SOMETHING>"~$ $ export GOOGLE_APPLICATION_CREDENTIALS=</Users/grantespanet/Downloads/myfile.json>

But I get this error: -bash: syntax error near unexpected token newline

I have also tried this:

<INSERT_SOMETHING>:~$ $ export GOOGLE_APPLICATION_CREDENTIALS=/Users/grantespanet/Downloads/myfile.json

but nothing happens

I know the command is pointing to the correct file location. How can I successfully Authenticate Application Default Credentials?

like image 403
grantespo Avatar asked Apr 03 '26 03:04

grantespo


1 Answers

The command you are executing is a variable assignment. Variable GOOGLE_APPLICATION_CREDENTIALS is given the value that follows the = sign.

The export keyword has the effect of making this variable available to child processes of the shell you are executing it from. In plain terms, it means any program you launch from the shell will have a copy of that variable (with its value) and can use it.

It is entirely normal for that command to produce no visible result or output.

The instructions you have probably require you to launch other commands after this one, which will use this value. Try performing the next steps.

like image 151
Fred Avatar answered Apr 08 '26 04:04

Fred



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!