You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WEB-956: share authenticated session across tabs and windows
Currently AuthenticationService persists the user credentials in
sessionStorage by default (and only opts into localStorage when the
optional Remember Me checkbox is checked). sessionStorage is scoped to
a single browser tab/window, so any link to a Mifos URL opened from
outside the current tab — email, chat, bookmark, target="_blank", a new
browser window — boots into an empty storage and the
AuthenticationGuard sends the already-logged-in user back to /login.
This change adopts the pattern used by `@supabase/auth-js`
(GoTrueClient.ts) and Auth0's SPA SDK: localStorage as the single
source of truth for the session, plus a BroadcastChannel for cross-tab
synchronisation.
- The `storage` field is now `localStorage` unconditionally so the
session is visible to every tab/window of the same origin. The
`rememberMe` flag is preserved for the backend token expiration
policy, but no longer controls which Storage is used in the browser.
- A BroadcastChannel named `mifosXAuth` is created lazily (with a
feature-detect fallback for older browsers). On login the service
broadcasts a `{ type: 'login' }` message; on logout it broadcasts
`{ type: 'logout' }`. Other tabs listening on the same channel
rehydrate or wipe their state accordingly without waiting for a
reload — matching what users expect from modern SaaS UIs.
Verified end-to-end against the isolated docker-compose stack:
master: click on a Mifos link while logged in → re-login forced
fix: click on a Mifos link while logged in → session preserved
fix: logout in tab A → tab B reacts live
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0 commit comments