LearnOPhile
LearnOPhile

Reputation: 1551

Is it possible to let GOOGLE_APPLICATION_CREDENTIALS point to non-service-account credentials?

Service accounts have .json key files that it is easy to point to so that google cloud applications use those credentials by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable.

Is it possible to use the same environment variable but pointing it to a standard user account .json key file (like one belonging to my own gsuite account)?

Upvotes: 0

Views: 1284

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75725

When you perform a gcloud auth application-default login a JSON file is created

  • On Windows, this is %APPDATA%/gcloud/legacy_credentials/<USER_EMAIL>/adc.json
  • On other systems, $HOME/.config/gcloud/legacy_credentials/<USER_EMAIL>/adc.json

If you set your GOOGLE_APPLICATION_CREDENTIALS to point to this user credential file, it works; the credential of the user will be used.

If the users are the only one logged on their computer, you can also unset the env var. The same file will be automatically retrieved by the library (well-known location)

Upvotes: 5

Related Questions