Repository navigation
OpenConceptLab/ocl_online#535 | An expired session signs the user back in instead of ending on Keycloak's "Invalid redirect uri" - #67
Merged
Conversation
…k in instead of ending on Keycloak's "Invalid redirect uri" Same fix as the Mapper's (OpenConceptLab/oclmap#109). A 401 first renews the token silently while the Keycloak session lives, at most once every 10 minutes. The forced sign-out returns to LOGIN_REDIRECT_URL, encoded, instead of an unencoded /#/signin?returnTo=... address Keycloak rejects. The page to come back to waits in sessionStorage, and the next load goes straight to sign-in. - logoutUser runs once even when several requests are turned down together - a second forced sign-out within 10 minutes stays signed out instead of looping - the sign-in callback is never redirected away; old records expire - storage errors can't stop the app from rendering - the unused session_expired flag is gone - adds `npm test` (node:test) with tests for src/common/ssoSession.js Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
snyaggarwal
commented
Oct 19, 2026
snyaggarwal
left a comment
Contributor
Author
There was a problem hiding this comment.
Verdict: Approve
Issue complete: yes. This applies the same safe forced-sign-out flow as the Mapper: the registered base URL is used for logout, the current page is retained in same-tab storage, and callback/loop/storage failure cases are guarded. Normal sign-out remains unchanged.
Security blockers: none. The return target originates from the current same-origin location and continues through the existing same-site return handling.
Verification: all 20 local tests passed, including the new forced logout and resume coverage. GitHub ESLint and Snyk checks pass.
(snyaggarwal • ReviewAutomation/GPT-5)
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.
Fixes the TermBrowser v3 part of OpenConceptLab/ocl_online#535. This is the same fix as OpenConceptLab/oclmap#109.
Why
TBv3's forced sign-out (a 401 from the API) built
post_logout_redirect_uri=<origin>/#/signin?returnTo=…, unencoded. The browser never sends the#…part, so Keycloak receives a bare origin with a trailing slash, rejects it, and the user ends on "We are sorry… Invalid redirect uri" instead of the sign-in page.What changes
prompt=noneand reloads. It tries this at most once every 10 minutes. The forced sign-out runs only if renewal fails.LOGIN_REDIRECT_URL, encoded. On a forced sign-out, the page to come back to waits insessionStorage(forced_sign_out), and the next load goes straight to sign-in and back to that page.logoutUserruns once even when several requests are turned down together.session_expiredsessionStorage flag is removed. Theauth.session_expiredlocale string was already unused and is left as is.npm testscript (node --test, as in oclmap) andsrc/common/__tests__/ssoSession.test.js. These are the first tests forssoSession.jshere; the file's original part is identical to oclmap's.Verification
npm test: 20 pass. ESLint, including the spellcheck rule, is clean on the changed files./orgs/CIEL/?x=1produced exactly one logout, withpost_logout_redirect_uri=http%3A%2F%2Flocalhost%3A4011, then sign-in, with/orgs/CIEL/?x=1saved as the page to return to./with no reload loop.Before deploying
Confirm in the Keycloak admin console that the
oclv3client acceptshttps://app.v3.openconceptlab.orgas a post-logout redirect URI.Companion PRs (deployable in any order): OpenConceptLab/oclmap#109 and OpenConceptLab/oclapi2#946 (encodes the URLs it passes to Keycloak).
🤖 Generated with Claude Code