mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-19 00:30:12 +01:00
The auth middleware was returning JSON error messages ("No authentication token
provided") for web UI requests, which displayed as plain text in the browser.
Changes:
- Added isAPIRequest check to detect if request is for /api/* or web UI
- For web UI requests without auth: redirect to /login (HTTP 302)
- For API requests without auth: return JSON error (HTTP 401)
- Applied same logic for all auth failure scenarios (no token, invalid token,
invalid claims, user not found)
This fixes the issue where users see JSON errors in the browser instead of
being properly redirected to the login page when authentication fails.
|
||
|---|---|---|
| .. | ||
| auth.go | ||