Skip to content

Re-authenticate instead of going blank when the session is lost#3042

Open
dvdstelt wants to merge 1 commit into
masterfrom
fix-auth-blank-on-token-expiry
Open

Re-authenticate instead of going blank when the session is lost#3042
dvdstelt wants to merge 1 commit into
masterfrom
fix-auth-blank-on-token-expiry

Conversation

@dvdstelt

@dvdstelt dvdstelt commented Jun 24, 2026

Copy link
Copy Markdown
Member

Problem

When OIDC auth is enabled and the access token expires (and silent renewal does
not succeed), App.vue renders nothing and the user has to manually refresh the
browser to recover.

App.vue gates the entire app behind shouldShowApp (authEnabled,
isAuthenticated, isAnonymousRoute). On token expiry, oidc-client-ts clears
the token, isAuthenticated flips to false, and that v-if renders nothing.
Nothing re-triggers authentication, so the page stays blank until a refresh
re-runs the auth flow on mount.

Fix

Watch for the session being lost while the app is running and re-trigger
authentication via the existing useAuth().authenticate() flow:

  • With a live identity-provider session this is a silent redirect round-trip and
    the user keeps working.
  • Otherwise the user lands on the provider's login page.
  • Skipped on anonymous routes (e.g. the logged-out page) and while a sign-in is
    already in progress, to avoid loops.

Tests

  • App.spec.ts: re-authenticates on token loss; does not while already
    authenticating; does not on an anonymous route.
  • Existing authentication integration specs still pass; typecheck and lint clean.

Notes

  • this is a pre-existing auth/session bug, so it targets master directly.
  • Renewal reliability itself (so the token rarely lapses in the first place) is an
    identity-provider configuration concern (the provider must grant offline_access
    so a refresh token is issued); ServicePulse already requests it.

@dvdstelt dvdstelt requested a review from ramonsmits June 24, 2026 23:21
@dvdstelt dvdstelt changed the base branch from authorization to master June 25, 2026 00:15
App.vue renders the whole app behind shouldShowApp (authEnabled, isAuthenticated,
isAnonymousRoute). When the access token expired and silent renewal failed,
isAuthenticated flipped to false and the app rendered nothing, requiring a manual
browser refresh to recover.

Watch for the session being lost while running and re-trigger authentication: with
a live identity-provider session this is a silent redirect round-trip; otherwise the
user lands on the provider's login page. Skipped on anonymous routes and while a
sign-in is already in progress.
@dvdstelt dvdstelt force-pushed the fix-auth-blank-on-token-expiry branch from 5bdb083 to a9b62fe Compare June 25, 2026 00:21
@ramonsmits ramonsmits requested a review from PhilBastian June 25, 2026 08:56
@PhilBastian PhilBastian requested a review from johnsimons June 25, 2026 09:05
Comment thread src/Frontend/src/App.vue
// renewal failed), re-trigger authentication instead of rendering a blank page. With a live
// identity-provider session this is a silent redirect round-trip; otherwise the user lands on
// the provider's login page. Without this the app renders nothing until a manual refresh.
watch([authEnabled, isAuthenticated, isAnonymousRoute], ([enabled, authenticated, anonymous]) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that all this logic, including the isAnonymousRoute, isn't actually the responsibility of the App page and should instead be in the authStore. Pulling in @warwickschroeder for comment.

@warwickschroeder warwickschroeder Jun 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it probably shouldn't live here. I mean it'll work but its better handled in the auth domain. We are already handling OIDC events in useAuth.ts. These could be used to pickup on the "token exired" or "silent renewal error" events and then reauthenticate. This way we arent "watching" a proxy state, but rather reacting to the actual OIDC event.

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.

3 participants