Skip to content

fix: restore OAuth access_token forwarding in buildHttpClientV2#31

Open
spbsoluble wants to merge 3 commits intofeat/ca-cleanup-enrollment-fieldsfrom
fix/oauth-access-token-regression
Open

fix: restore OAuth access_token forwarding in buildHttpClientV2#31
spbsoluble wants to merge 3 commits intofeat/ca-cleanup-enrollment-fieldsfrom
fix/oauth-access-token-regression

Conversation

@spbsoluble
Copy link
Copy Markdown
Contributor

Summary

  • Restores AccessToken, Audience, and Scopes fields to the CommandConfigOauth struct literal in buildHttpClientV2 in both v24/api/keyfactor/v1/client.go and v24/api/keyfactor/v2/client.go
  • These fields were silently dropped by commit 2b88eb2 (2026-03-18), causing pre-fetched access token auth mode to fall back to environment variables or config file credentials

Root cause

When a user configures the provider with only hostname + access_token (no client_id/client_secret/token_url), buildHttpClientV2 would construct a CommandConfigOauth without the token — it was never forwarded to the auth client.

Test plan

  • TestCommandConfigOauth_AccessTokenFieldPropagation — verifies AccessToken, Audience, Scopes propagate from auth_providers.Server to CommandConfigOauth (exact code path in buildHttpClientV2)
  • TestCommandConfigOauth_AccessTokenOnlyNoClientCreds — verifies access-token-only config is classified as "oauth" auth type
  • Provider-level unit + integration regression tests in keyfactor/provider_oauth_test.go

Impact

Fixes customer regression introduced in provider v2.8.0. Pre-fetched access token mode (hostname + access_token only) is now correctly forwarded.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant