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

fix: expand on x-goog-user-project to handle auth.getClient() #831

Merged
merged 6 commits into from Nov 21, 2019

Conversation

bcoe
Copy link
Contributor

@bcoe bcoe commented Nov 21, 2019

What is this?

This expands on the initial implementation of x-goog-user-project header population, such that headers are appropriately populated when auth.getClient().getRequestHeaders() is called, the initial approach only supported auth.getRequestHeaders().

Thanks to @JustinBeckwith for pointing out this code-path which would have bitten us.

Implementation Details

This implementation is closer to @broady's initial recommendation of having the logic in UserRefreshClient rather than my suggestion of GoogleAuth, however, I've moved the logic for header population into OAuth2Client, this approach seemed elegant because:

  • OAuth2Client already implements getRequestHeaders (and several clients, like UserRefreshClient rely on its implementation.
  • It puts us in a position to support quota_project across clients.
  • It seemed the most elegant of a few approaches I tried.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 21, 2019
@bcoe bcoe merged commit 3646b7f into master Nov 21, 2019
@bcoe bcoe deleted the x-goog-project-update branch November 21, 2019 18:58
@broady
Copy link
Contributor

broady commented Nov 21, 2019

LGTM

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

4 participants