Replace keycloak-js with generic OIDC client#69
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ample Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the backwards-compatibility layer added for REACT_APP_KEYCLOAK_* vars. Operators must now use REACT_APP_OIDC_AUTHORITY and REACT_APP_OIDC_CLIENT_ID directly. The Helm chart no longer accepts oidc.providerUrl + oidc.realm; use oidc.authority instead. Revert this commit to restore the deprecation shim. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
danielfdsilva
approved these changes
Apr 28, 2026
Member
danielfdsilva
left a comment
There was a problem hiding this comment.
Looks nice and cleaner.
Did not do a local test, but went through the code
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.
What I'm changing
This PR generalizes our Auth tooling to work with any OIDC provider, rather than just Keycloak.
This is a result of me receiving CORS errors when we were attempting to fetch the profile from the Keycloak
/accountendpoint. I think realized that all of the details regarding a user's account were already present in the ID Token returned upon login, thus meaning that we don't actually need to fetch from the/accountendpoint. Furthermore, it became apparent that there was nothing Keycloak specific about the auth tooling that we had (Keycloak is, afterall, an OIDC provider) so we could generalize this tooling to support any other OIDC provider.How I did it
I leaned on Claude to implement this. While this PR touches many files, the bulk of the affected logic is in
packages/client/src/auth/Context.tsxand everything else is simply adapting to new names.Claude PR details
Summary
keycloak-jsforreact-oidc-context+oidc-client-tsso the app works with any OIDC IdP (Keycloak, Auth0, Cognito, Okta, Entra, Google, …). Profile data now comes from the parsed ID token — no more/realms/<realm>/accountcall, which fixes the CORS error that surfaced on the EOEPCA dev Keycloak.REACT_APP_OIDC_AUTHORITYandREACT_APP_OIDC_CLIENT_IDas the new config interface. The legacyREACT_APP_KEYCLOAK_{URL,REALM,CLIENT_ID}vars keep working via a shim inresolveAuthConfig()that derivesauthority = "<url>/realms/<realm>"and logs oneconsole.warnpointing operators at the migration docs..env.example, root + client READMEs all updated. Helmvalues.yamlaccepts bothoidc.authority(new) and legacyoidc.providerUrl+oidc.realm; templates always emit the new env vars, verified viahelm templatein both configurations.Test plan
resolveAuthConfigcovers env precedence, shim derivation, trailing-slash normalization, partial-config, and empty-string handling (7 tests, all passing)ItemListTS2307 errors are unrelated to this PR)/accountCORS error, login/logout round-trip works,Authorization: Bearer …sent on protected STAC API callsREACT_APP_OIDC_*env vars: no deprecation warning, identical behaviorhelm templaterendered withoidc.authority+oidc.clientIdand with legacyoidc.providerUrl+oidc.realm+oidc.clientId; both emit expectedREACT_APP_OIDC_*env varsFollow-ups (intentionally out of scope)
localStorage-backed token store — file as a separate issue for tracking.STAC_APItrailing-slash URL-joining bug discovered during manual verification — pre-existing onmain, separate PR.See the implementation plan at
docs/plans/2026-04-23-oidc-migration.mdfor the full story.🤖 Generated with Claude Code
Important
This PR includes breaking changes with regards to the environment variables used to construct authentication. I initially assumed we would want a plan to support existing deployments by deprecating the Keycloak tooling and using a shim, but I chose to remove that (cc132ea) in favor of a simpler system given how few deployments exist at this time (I am assuming).