Skip to content

Load content of JSON credentials directly into GOOGLE_APPLICATION_CREDENTIALS environment variable without using file path. #1611

@sheeeng

Description

@sheeeng

According to official documentation[1][2], GOOGLE_APPLICATION_CREDENTIALS environment variable can only accept file path to a JSON formatted credentials file.

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials.json"

As a user, I would want to load the content of JSON credentials directly into GOOGLE_APPLICATION_CREDENTIALS environment variable without using the file path. I want to prevent writing credentials to the file system.

export GOOGLE_APPLICATION_CREDENTIALS="{"type": "service_account", "project_id": "changeit-project", ...}"

Please forgive my ignorance. Is it possible that we use GoogleCredential.FromJson(string json) function[3] as a workaound?

P.S. There is also a related case[4] under google-api-go-client project.

[1] https://googleapis.github.io/google-cloud-dotnet/docs/Google.Cloud.BigQuery.V2/index.html#authentication
[2] https://cloud.google.com/docs/authentication/getting-started
[3] https://googleapis.dev/dotnet/Google.Apis.Auth/1.48.0/api/Google.Apis.Auth.OAuth2.GoogleCredential.html#Google_Apis_Auth_OAuth2_GoogleCredential_FromJson_System_String_
[4] googleapis/google-api-go-client#185

Metadata

Metadata

Assignees

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions