-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
google: Provide method to retrieve project ID configured on gcloud #241
Comments
/cc @zombiezen |
Friendly bump, also seeing when we use FindDefaultCredentials() method on a local dev machine, the ProjectID field of DefaultCredentials comes as empty string. |
The behavior of Shelling out to /cc @deKlerk |
Bump, I also think there should be a way to retrieve the project ID in local like you can with other languages. This is quite annoying for some instances like secrets that require the project ID to be set. |
Bump as well. |
I think it's not unreasonable to ask that "Application Default Credentials" would include a project ID. Almost every GCP API requires (and almost every resource is associated with) a project, so having a default project seems to fit the bill here. Once we agree on that, I think it becomes a no-brainer that the application default credentials Go SDK API would provide that project ID as well. I think it's also self-evident that the |
(moved from googleapis/google-cloud-go#707)
It looks like Go client libraries do not provide a method do to this. I've been shelling out to
gcloud
myself but not sure what's the way guaranteed to work. It would be great if this library can provide a method that will keep working.On a side note, when I use the
FindCredentials()
method on my dev machine, which has ADC enabled withgcloud auth application-default login
, the ProjectID field of DefaultCredentials comes as empty string.Looks like other Google Cloud libraries are using the following commands:
gcloud config config-helper --format json
gcloud -q config list core/project --format=json
Examples:
Python: https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/d020426e170d9d8ab5f9d8d37626c278fed4770c/google/auth/_cloud_sdk.py#L111-L133
Node.js: https://github.com/google/google-auth-library-nodejs/blob/bd13376281a3af6e73fb729ea867950739c3c899/ts/lib/auth/googleauth.ts#L157-L160
The text was updated successfully, but these errors were encountered: