Files
romm/backend/decorators
Georges-Antoine Assi f26c3234d7 fix(auth): return 401 for unauthenticated requests, keep 403 for missing scopes
Protected routes answered 403 both when there was no session and when the
authenticated user lacked the required scope. The frontend read every 403
as session expiry, cleared the session cookie and redirected to /login, so
a permission denial (for instance saving a state without the save scope)
tore down whatever the user was doing, including a running emulator.

`protected_route` now uses its own scope guard that raises 401 with a
`WWW-Authenticate` header when the caller is unauthenticated, and 403 when
the caller is authenticated but under-scoped. The axios interceptor only
redirects on 401 and lets 403s surface inline to the caller, refreshing the
CSRF cookie when the backend rejected the CSRF token.

Endpoint assertions for unauthenticated requests move from 403 to 401;
authenticated under-scoped cases stay 403.

Fixes #4045
2026-08-01 14:12:40 -04:00
..
2024-05-12 21:40:18 -04:00
2026-06-21 17:42:25 -04:00