Is your feature request related to a problem? Please describe.
When running locally and being authenticated using gcloud or in GKE/GCE/Cloud Run, etc on GCP I would expect the library to pick up the credentials automatically using Google ADC. I'd be super happy with just having it check for GOOGLE_APPLICATION_CREDENTIALS or gcloud auth as a first step.
Describe the solution you'd like
Google Application Default Credentials does the following checks:
- Checks if the environment variable
GOOGLE_APPLICATION_CREDENTIALS is set. If it's set it should be a path pointing to a json credentials file for a service account
- Checks if you are authenticated using
gcloud by checking:
%APPDATA%/gcloud/application_default_credentials.json on Windows
$HOME/.config/gcloud/application_default_credentials.json on Linux/OSX
- Checks if you are running on GKE/GCE/AppEngine/Cloud Functions/Cloud Run.
An example of how it's done in the auth library provided by Google in Go: https://github.com/golang/oauth2/blob/f6687ab2804cbebdfdeef385bee94918b1ce83de/google/default.go#L111
Is your feature request related to a problem? Please describe.
When running locally and being authenticated using
gcloudor in GKE/GCE/Cloud Run, etc on GCP I would expect the library to pick up the credentials automatically using Google ADC. I'd be super happy with just having it check forGOOGLE_APPLICATION_CREDENTIALSorgcloud authas a first step.Describe the solution you'd like
Google Application Default Credentials does the following checks:
GOOGLE_APPLICATION_CREDENTIALSis set. If it's set it should be a path pointing to a json credentials file for a service accountgcloudby checking:%APPDATA%/gcloud/application_default_credentials.jsonon Windows$HOME/.config/gcloud/application_default_credentials.jsonon Linux/OSXAn example of how it's done in the auth library provided by Google in Go: https://github.com/golang/oauth2/blob/f6687ab2804cbebdfdeef385bee94918b1ce83de/google/default.go#L111