1.4 KiB
1.4 KiB
Auth & Session Reliability Notes
Last updated: 2026-05-13
Known issue
Users are intermittently prompted to sign in again despite apparently valid prior session state.
Confirmed risk contributors in code
- Duplicated logout/cookie clearing logic across multiple components.
- Mixed callback cookie names in runtime history (
next-auth.callback-urland__Secure-next-auth.callback-url). - Redirect URL parsing that could fail hard on malformed/unexpected URL inputs.
- Hard SSR redirects to
/auth/signinon missing/transient upstream account/contact states.
Stabilisation changes started
- Added
lib/auth/sessionClient.js:- normalized cookie/session artifact cleanup
- shared signed-out callback path by locale
- shared
performPortalSignOut(...)helper
- Adopted helper in:
components/timeout/index.jscomponents/myportal/servicebanner.jscomponents/header.js
- Updated NextAuth callback locale detection to check both callback cookie variants.
- Hardened NextAuth URL append and redirect parsing fallbacks.
Remaining auth hardening backlog
- Migrate remaining logout implementations to shared helper.
- Add request-correlation-safe auth diagnostics (no secrets/tokens).
- Evaluate session TTL/update strategy (
maxAge,updateAge) with production evidence. - Add env validation checks for
NEXTAUTH_URL,CY_API_ROOT, proxy/header assumptions.