Skip to main content

Authentication and sessions

Imported component documentation. Source: melodee-project/melodee-admin-ui at commit e0ed63ec61a069159a1482d1ecd11dd480a6a60f. Version 2026.11.0-rc.0. License MIT. Status: release candidate; not published, deployed, production-qualified or security-reviewed. This is the component's committed documentation, not proof of a distribution release or production qualification.

The administration UI is not an identity provider and does not render a sign-in form. Interactive sign-in, recovery, device consent and recent-auth step-up are owned by the separately served Melodee Auth UI, backed by melodee-api.

Browser session​

  1. The operator navigates to the configured Auth UI entry (/auth/login by default, same origin).
  2. The API sets an HttpOnly, same-origin browser session cookie and a melodee_csrf cookie. No session token is returned to JavaScript.
  3. The admin UI verifies the session with one authenticated GET /api/v1/capabilities read. A 401 triggers exactly one cookie refresh attempt; a second 401 is an anonymous session.
  4. Unsafe requests send X-CSRF-Token read from the non-HttpOnly melodee_csrf cookie. The API remains the authority for origin/CSRF checks.
  5. Sign-out uses POST /api/v1/auth/logout, which revokes the browser session through the API. The UI clears only in-memory session state.

No bearer token, refresh credential, magic-link secret or passkey object is written to local/session storage, IndexedDB, a URL, logs or analytics.

401 versus 403​

  • 401 after the single refresh: session expired, /auth/required with a safe internal continuation. The UI does not retry indefinitely and does not show a fake login form.
  • 403: authenticated but not permitted. The page keeps navigation and shows the restricted capability; it never enters a login loop.
  • 404: missing record with a safe back action.
  • 409/412: revision conflict; re-read and compare, never auto-overwrite.
  • 429: respect the cooldown; mutations are never retried automatically.

Capability discovery​

The pinned API has no endpoint returning the caller's administrative capabilities. The UI performs five bounded safe reads (job-controls, one review, volumes, snapshots, one account) and treats the returned 200/403 as the authoritative capability check. Results live in memory and refresh on demand. A successful page read or a page 403 updates the same map. No hidden control is treated as authorization.

Return-to-administration limitation​

The Auth UI's continuation allowlist (melodee-auth-ui/src/api/continuation.ts) contains only its own /auth/account/* and /auth/device paths. It does not publish a cross-application post-sign-in redirect. The admin UI therefore:

  • links to the Auth UI and explains the boundary;
  • accepts only a same-origin internal returnTo path for its own /auth/required screen;
  • never passes a token, code, account id or external URL.

A seamless automatic return requires an Auth UI/reverse-proxy change approved by the owner. This is an external integration blocker, not a reason to duplicate authentication.

Device approval/denial stays in the Auth UI at /auth/device. The admin UI links to it. There is no admin-wide pending-device or consent-grant list in the contract, and the UI does not mutate consent.