Login & Session Management
The Web UI authenticates users via the /api/login REST API endpoint.
Authentication Flow
- On startup, the UI checks for an existing JWT token stored in browser
localStorageunderruseon_token. - If no valid token exists, the user is presented with the modal
Logindialog. - Upon submitting valid credentials (e.g.
adminand password), the backend returns a signed 1-hour JWT token with user roles and claims. - The token is attached to all outbound
fetchand API requests in theAuthorization: Bearer <TOKEN>header. - If the server responds with
401 Unauthorized(e.g. token expired, or user role revoked in BadgerDB), the UI automatically clearslocalStorageand prompts the login modal.