djc / gcp_auth

Minimal authentication library for Google Cloud Platform (GCP)
Other
63 stars 38 forks source link

Load default credentials from right path on Windows #112

Closed andreban closed 5 months ago

andreban commented 5 months ago

On Windows, the default credentials file is located in the %APPDATA%\gcloud\application_default_credentials.json. The existing implementation was looking for credentials in $HOME/.config/gcloud/application_default_credentials.json, which only works on MacOS and Linux.

This change creates a config_dir() function that has different implementations for Linux/MacOS and Windows platforms, and returns the appropriate path for each.

andreban commented 5 months ago

@djc Thank you for the review. Addressed the comments and re-tested on Windows / MacOS. PTAL.