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

discover account associated with token provider credentials #256

Open
danburkert opened this issue Apr 24, 2024 · 1 comment
Open

discover account associated with token provider credentials #256

danburkert opened this issue Apr 24, 2024 · 1 comment

Comments

@danburkert
Copy link
Contributor

google-cloud-auth provides a mechanism to get a token (presumably) from the application default credentials. Is there a way to determine the account associated with the token, either a user email address or the service account email address?

@yoshidan
Copy link
Owner

Currently, there is no API to directly retrieve the associated service account from the token.

In GCE, GKE and Cloud, Run the service account corresponding to the IAM role applied to the Node or Pod is used.
This service account can be obtained at.

let service_account_email =  google_cloud_metadata::email(“default”).await?

In the case of using the credentials file, it is held in the DefaultTokenSourceProvider. However, there is no API to obtain these from each component client (storage, pubsub, etc.), so they must be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants