When Auth.js can't refresh the Keycloak access token (apps/web/lib/auth/authjs.ts), the jwt callback deletes the access and refresh tokens but keeps the session. The user still looks signed in, but:
sub it had, which can be stale.This showed up on 2026-10-18 when taskl.ie moved from the minecraft realm to the new tasklie realm (https://auth.taskl.ie/realms/tasklie). Existing sessions failed to refresh against the new realm (REFRESH_TOKEN_ERROR invalid_token) and stayed half signed in, under the old user ID with no memberships, until the user signed out by hand.
invalid_grant), end the session (jwt returns null), so requireUser sends the user to /login..env.example to the tasklie realm.Shipped to production in #85 (rebuild → main, merge commit 95aacaa); tasklie-ui is running production-sha-95aacaa. A sign-in through auth.taskl.ie/realms/tasklie was checked against the new build.
PR: https://github.com/ParadauxIO/taskl.ie/pull/82 (into
rebuild).A rejected refresh (4xx) now ends the session. The
jwtcallback returns null, so the user is sent to/login. A network error or 5xx keeps the session and retries on the next request. A session from a different issuer is ended immediately. Lint, typecheck and the unit suite pass, with 9 new tests intest/unit/session-refresh.test.ts.