FirestoreRestore icon indicating copy to clipboard operation
FirestoreRestore copied to clipboard

Failed to create Google HTTP client: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

Open rupertbulquerin opened this issue 7 years ago • 6 comments

I already add to path set GOOGLE_APPLICATION_CREDENTIALS="C:\Users\username\Downloads\google-account.json"

but still failed to create google http client

rupertbulquerin avatar Nov 20 '18 02:11 rupertbulquerin

And also what do you mean by this?

All commands must be run with the GOOGLE_APPLICATION_CREDENTIALS environment variable set to the path where the JSON key is located.

is it something like this? in cmd GOOGLE_APPLICATION_CREDENTIALS="PATH" FirestoreRestore -backup -wait -p myapp -b gs://mybucket -n backup

rupertbulquerin avatar Nov 20 '18 02:11 rupertbulquerin

Oh! You're on windows :)

According to the WINDOWS section of Google's auth guide, you can set an environment variable in your session with set GOOGLE_APPLICATION_CREDENTIALS=[PATH].

ChristianAlexander avatar Nov 20 '18 03:11 ChristianAlexander

Oh! You're on windows :)

According to the WINDOWS section of Google's auth guide, you can set an environment variable in your session with set GOOGLE_APPLICATION_CREDENTIALS=[PATH].

I already did (setting up the environmental variables path manually). But still failed to create google http client.

rupertbulquerin avatar Nov 20 '18 03:11 rupertbulquerin

Hmm, this uses Google's default authentication token code. The library they use says:

It looks for credentials in the following places, preferring the first location found:

  1. A JSON file whose path is specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable.
  2. A JSON file in a location known to the gcloud command-line tool. On Windows, this is %APPDATA%/gcloud/application_default_credentials.json. On other systems, $HOME/.config/gcloud/application_default_credentials.json.
  3. On Google App Engine standard first generation runtimes (<= Go 1.9) it uses the appengine.AccessToken function.
  4. On Google Compute Engine, Google App Engine standard second generation runtimes (>= Go 1.11), and Google App Engine flexible environment, it fetches credentials from the metadata server. (In this final case any provided scopes are ignored.)

ChristianAlexander avatar Nov 20 '18 03:11 ChristianAlexander

You might try putting the credential file in your appdata folder?

ChristianAlexander avatar Nov 20 '18 03:11 ChristianAlexander

Failed to create Google HTTP client: google: error getting credentials using GOOGLE_APPLICATION_CREDENTIALS environment variable: open "C:\Users\username\AppData\Roaming\gcloud\googleaccount.json": The filename, directory name, or volume label syntax is incorrect.

rupertbulquerin avatar Nov 20 '18 03:11 rupertbulquerin