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

Expose a getCredentials method #169

Closed
stephenplusplus opened this issue Oct 16, 2017 · 4 comments
Closed

Expose a getCredentials method #169

stephenplusplus opened this issue Oct 16, 2017 · 4 comments
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Comments

@stephenplusplus
Copy link
Contributor

The private_key and client_email properties of a service account JSON file are required for crypto operations, such as generating a signed URL. Example from @google-cloud/storage: https://github.com/googleapis/nodejs-storage/blob/469530c744c42096e46f39f409272cca05eaf02a/src/file.js#L1646.

Evidently, the GCP metadata server can return these values. google-auth-library is the most knowledgeable of the environment and authentication choices made by the user, and ideally would expose a method like authClient.getCredentials().

This method would return the contents of the service account JSON key file, or if the user did not give a key file, i.e. they're on GCP, it would read the properties from the metadata server.

@bantini bantini added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. Status: Acknowledged labels Oct 18, 2017
@inlined
Copy link

inlined commented Oct 19, 2017

Just to make sure we're all on the same page, the Google metadata service will not reveal a private key, but that's not needed for the signed URLs in @google-cloud/storage. Instead, @google-cloud/storage should use an OAuth token from the metadata server and call IAM's signBlob API.

@bantini
Copy link
Contributor

bantini commented Nov 6, 2017

@lukesneeringer @stephenplusplus What should be the signature of the method? What should be the signature of the callback function?

@lukesneeringer
Copy link

/cc @stephenplusplus for a decision

My gut is that it optionally takes a key file, and it returns a (potentially partial) service account dictionary.

@stephenplusplus
Copy link
Contributor Author

We actually talked it through a bit in the PR: #180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.
Projects
None yet
Development

No branches or pull requests

4 participants