Skip to content
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

Add method to retrieve resource Project ID from GoogleCredentials #1614

Open
psx95 opened this issue Jan 15, 2025 · 3 comments
Open

Add method to retrieve resource Project ID from GoogleCredentials #1614

psx95 opened this issue Jan 15, 2025 · 3 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@psx95
Copy link

psx95 commented Jan 15, 2025

Is your feature request related to a problem? Please describe.
GoogleCredentials currently does not provide access to the resource project ID.

It only has method to provide access to the currently used Quota Project ID, which may be different from the resource project ID.

Describe the solution you'd like
A method to retrieve the current resource project ID. Similar methods exists in classes derived from GoogleCredentials such as ServiceAccountCredentials.

Additional context
I'm using this library to retrieve ADCs to authenticate to Google services. Due to the absence of a method to retrieve resource Project ID, the user is required to explicitly set the resource project ID.

@lqiu96 lqiu96 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jan 27, 2025
@lqiu96
Copy link
Contributor

lqiu96 commented Jan 27, 2025

Can you provide a more details or an example of where you would need to retrieve the Project ID? From a search, I see that there are currently only two *Credential* classes that offer this (GdchCredentials and ServiceAccountCredentials).

Which *Credential* class are you using that requires this? Or is it just that user is required to explicitly set the resource project ID is an annoyance?

@psx95
Copy link
Author

psx95 commented Jan 31, 2025

Hi @lqiu96,
Thank you for your response. I am using the GoogleCredentials class.

No *Credential* class requires user project ID to function, at least for my use case.

It is mostly a user annoyance and could lead to better UX if resolved.

Additional Context on Use-Case

I am retrieving the Application Default Credentials for an auth extension I am working on. Here is the code that retrieves the credentials.

The credentials object I receive has no method to retrieve the user project ID. Absence of this method results in no reasonable default and forces the user to input the project ID.

The end goal is to achieve something similar to this logic defined in a similar GCP Go auth extension.

@lqiu96
Copy link
Contributor

lqiu96 commented Feb 5, 2025

@sai-sunder-s Wanted to get your thoughts on this whenever you get a chance. I don't think this sounds unreasonable but I'm not entirely sure if all of ADC will be able to have a project_id (and if not, what would a reasonable default be (empty string, null?)). Do you know how this is implemented for Python or other auth languages?

Would something like this be only scoped for ADC Credentials or maybe also 3PI Creds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants