Skip to content

Sign out at the provider before clearing anything locally - #148

Merged
vitramir merged 1 commit into
mainfrom
fix/sign-out-order
Aug 13, 2026
Merged

Sign out at the provider before clearing anything locally#148
vitramir merged 1 commit into
mainfrom
fix/sign-out-order

Conversation

@vitramir

Copy link
Copy Markdown
Contributor

Split out of #147, which is red for an unrelated reason: e13ee47 needs Environment.persistentShells, and CI regenerates src/gen/ from the BSR where that field does not exist yet. This branch carries only the sign-out change, off main.

Enabling Dex sessions makes it publish end_session_endpoint, which the app reads to decide whether signing out has anywhere to go — so every sign-out became an RP-initiated logout and the ordering started to matter.

signoutRedirect() reads the stored user for id_token_hint and removes the user itself. Clearing sessionStorage and calling removeUser() first only cost the hint — which Dex answers 400 to — and dropped isAuthenticated while the session was still live, so RequireAuth signed straight back in and the click read as a page reload.

Verified against a Dex build with sessions on, on the local VM: logout to a registered post_logout_redirect_uri redirects, an unregistered one is refused 400, and both new assertions fail against the pre-fix UserContext.

Dex publishes end_session_endpoint once sessions are enabled, and the app
reads that to decide whether signing out has anywhere to go -- so enabling
them turned every sign-out into an RP-initiated logout, and the order this
ran in started to matter.

signoutRedirect() reads the stored user for id_token_hint and removes the
user itself. Clearing sessionStorage and calling removeUser() first only
cost the hint, which Dex answers 400 to, and dropped isAuthenticated while
the session was still live -- so RequireAuth signed straight back in against
it and the click read as a page reload rather than a sign-out.

The provider goes first now, and the local clear happens only where there
was no session to end. That path navigates, because the signed-out flag is
read at mount and nothing else brings the app back through one.

Both new assertions fail against the pre-fix UserContext: one on the call
order, one on the local path not navigating. sandboxes-app carried the same
defect; chat-app and tracing-app already redirected first.
@vitramir
vitramir merged commit 09eda79 into main Aug 13, 2026
1 of 2 checks passed
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