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

Read JSON credentials from string instead of file #2197

Closed
llamafilm opened this issue Jul 20, 2023 · 1 comment
Closed

Read JSON credentials from string instead of file #2197

llamafilm opened this issue Jul 20, 2023 · 1 comment
Labels
type: question Request for information or clarification. Not an issue.

Comments

@llamafilm
Copy link

Is your feature request related to a problem? Please describe.
I'm storing the credentials.json data in an encrypted form which gets decrypted by my application on runtime. It's risky to write this back to disk in plaintext, so I'd like to login using this string in memory instead.

Describe the solution you'd like
How I authenticate now:

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'credentials.json'

How I'd like to authenticate:

GOOGLE_APPLICATION_CREDENTIALS = "string from variable"

Additional context
For what it's worth, there is a similar feature request for Go: googleapis/google-api-go-client#185

@parthea parthea added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Jul 24, 2023
@parthea
Copy link
Contributor

parthea commented Jul 24, 2023

Hi @llamafilm,

There was a feature added in googleapis/google-auth-library-python#1326 to add support for google.auth.load_credentials_from_dict() to load credentials from a dictionary, however that does not change the behaviour of the environment variable GOOGLE_APPLICATION_CREDENTIALS.

See
https://github.com/googleapis/google-auth-library-python/blob/a4135a3e9620a2cbf99957858c13780b92ff707c/google/auth/_default.py#L134

If you'd like to propose a feature request to change the behaviour of GOOGLE_APPLICATION_CREDENTIALS, please file a feature request for google-auth here.

I'm going to close this issue as the handling for GOOGLE_APPLICATION_CREDENTIALS is specific to google-auth but pease feel free to open a new issue if you have additional questions.

@parthea parthea closed this as completed Jul 24, 2023
@parthea parthea added type: question Request for information or clarification. Not an issue. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants