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

feat: add useJWTAccessAlways and defaultServicePath variable #1204

Merged
merged 5 commits into from Jul 2, 2021

Conversation

sofisl
Copy link
Contributor

@sofisl sofisl commented Jul 2, 2021

Piecemeal version of #1196

@sofisl sofisl requested a review from a team as a code owner July 2, 2021 17:05
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 2, 2021
Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two places I notice where we set defaultScopes but don't set client.useJWTAccessAlways = this.useJWTAccessAlways;:

credential.defaultScopes = this.defaultScopes;

and

credential.defaultScopes = this.defaultScopes;

I was also concerned by:

https://github.com/googleapis/google-auth-library-nodejs/pull/1204/files#diff-535a540500eec341838bd88c84b1795313a8ff9b556bad87ef89fb2fca061630R573

Where I notice you set useJWTAccessAlways, but we miss populating defaultScopes. Should we be setting defaultScopes here, or I wonder did we already set it in a related code path so we don't need to? we should probably double check.

To help protect future generations from having hiccups like these, why don't we add a private helper:

setAdditionalJWTConfig or something along those lines, which always sets all three variables?

@@ -583,6 +591,8 @@ export class GoogleAuth {
options = options || {};
const client = new JWT(options);
client.fromAPIKey(apiKey);
client.defaultServicePath = this.defaultServicePath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a special edge case where we don't need to set useJWTAccessAlways, where we're providing an explicit API key to use (which I'm betting is why we don't set defaultServicePath either).

@bcoe bcoe merged commit 79e100e into master Jul 2, 2021
@bcoe bcoe deleted the addUseJWTAccessAlwaysVar branch July 2, 2021 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants