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

ENH: Support authentication with service accounts #39

Closed
isidentical opened this issue Feb 11, 2021 · 7 comments · Fixed by #40
Closed

ENH: Support authentication with service accounts #39

isidentical opened this issue Feb 11, 2021 · 7 comments · Fixed by #40

Comments

@isidentical
Copy link
Contributor

Service accounts use a different credentials class (google.oauth2.service_account.Credentials) and mostly used within a file that is expored from GCP console. It would be nice to have a pydata_google_auth.load_service_account_credentials(path: os.PathLike) -> Credentials method which does the initalization.

@tswast
Copy link
Collaborator

tswast commented Feb 17, 2021

Can you help me understand this use case a little better? When would you like to use this function compared to calling google-auth directly or relying on the GOOGLE_APPLICATION_CREDENTIALS environment variable?

@isidentical
Copy link
Contributor Author

The use case is having the equivalent of load_user_credentials, but for service auth. Example usage; https://github.com/isidentical/gdrivefs/blob/6993923963368726bf18112766e8d4d2574756f4/gdrivefs/core.py#L100-L110

@tswast
Copy link
Collaborator

tswast commented Feb 18, 2021

OK. That makes some sense to me (one library to do all auth). When I have some time I'll take a closer look at your PR.

@isidentical
Copy link
Contributor Author

Thanks!

@tswast
Copy link
Collaborator

tswast commented Apr 20, 2021

It's actually been on my wishlist for a while to have a single function that loads any type of credentials file. The JSON includes a type field for this purpose https://github.com/pydata/pydata-google-auth/blob/master/pydata_google_auth/cache.py#L119

What if we add a generic load_credentials_file function instead?

@isidentical
Copy link
Contributor Author

What if we add a generic load_credentials_file function instead?

Wouldn't it make sense to have this separately, and maybe use the load_credentials_file as a separate function?

@tswast
Copy link
Collaborator

tswast commented Apr 21, 2021

Yeah, that's fair. Doesn't hurt to have the explicit function.

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

Successfully merging a pull request may close this issue.

2 participants