fix: restore OAuth access_token forwarding in buildHttpClientV2#31
Open
spbsoluble wants to merge 3 commits intofeat/ca-cleanup-enrollment-fieldsfrom
Open
fix: restore OAuth access_token forwarding in buildHttpClientV2#31spbsoluble wants to merge 3 commits intofeat/ca-cleanup-enrollment-fieldsfrom
spbsoluble wants to merge 3 commits intofeat/ca-cleanup-enrollment-fieldsfrom
Conversation
… config Commit 2b88eb2 (2026-03-18) accidentally stripped AccessToken, Audience, and Scopes from the CommandConfigOauth struct literal in buildHttpClientV2 in both v1/client.go and v2/client.go. This broke pre-fetched access_token authentication mode where users supply only hostname + access_token without client_id/client_secret/token_url. Restore all three fields so the auth client receives the caller-provided token, audience, and scopes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AccessToken,Audience, andScopesfields to theCommandConfigOauthstruct literal inbuildHttpClientV2in bothv24/api/keyfactor/v1/client.goandv24/api/keyfactor/v2/client.go2b88eb2(2026-03-18), causing pre-fetched access token auth mode to fall back to environment variables or config file credentialsRoot cause
When a user configures the provider with only
hostname+access_token(noclient_id/client_secret/token_url),buildHttpClientV2would construct aCommandConfigOauthwithout the token — it was never forwarded to the auth client.Test plan
TestCommandConfigOauth_AccessTokenFieldPropagation— verifiesAccessToken,Audience,Scopespropagate fromauth_providers.ServertoCommandConfigOauth(exact code path inbuildHttpClientV2)TestCommandConfigOauth_AccessTokenOnlyNoClientCreds— verifies access-token-only config is classified as"oauth"auth typekeyfactor/provider_oauth_test.goImpact
Fixes customer regression introduced in provider v2.8.0. Pre-fetched access token mode (hostname + access_token only) is now correctly forwarded.