The Auth module is the entry point for every user interaction with SEAM. It handles credential validation on the client side, delegates the actual authentication to the backend over a REST call, and then wires the returned JWT into both the in-memory session state and the real-time EventBus WebSocket. All private routes are protected by a router-level guard that checks for a valid session before rendering any page.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM/llms.txt
Use this file to discover all available pages before exploring further.
Login flow
Validate the form
Before any network request is made,
FormValidator runs client-side checks on the login form. The email field must be a valid e-mail address and the password field must satisfy the built-in password rule. The submit button stays disabled until both fields pass.Call the login service
On a successful client validation, the page calls
login(email, password) from auth.service.js. The service delegates to the repository which issues POST /auth/login.Hydrate the in-memory session
The response object
{ user, token, permissions, sidebarItems } is destructured into the session singleton. permissions is stored as a Set<string> of nameUri strings for O(1) permission checks anywhere in the app.Persist to localStorage
The same payload is serialised and written to
localStorage under the key currentUser so the session survives a page reload.API endpoints
| Method | Path | Purpose |
|---|---|---|
POST | /auth/login | Exchange credentials for { user, token, permissions, sidebarItems } |
POST | /auth/register | Register a new user account |
Logout
Callinglogout() is the inverse of login(): it disconnects the WebSocket, wipes localStorage, and nulls every field on the session singleton.
Route guard
The router checks for an authenticated session before mounting any private page. IflocalStorage has no currentUser entry (or the entry is invalid), the user is immediately redirected to #/login. This guard runs on every hash-change event, so direct URL navigation cannot bypass it.
The session is rehydrated from
localStorage on every page load so users do not have to log in again after a browser refresh. The JWT is re-attached to EventBus at hydration time.Register form validation
The registration form uses its ownFormValidator schema that adds a confirmPassword match rule on top of the login schema: