diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index 78c5dae5..37d4823e 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -65,6 +65,12 @@ export const handleFetch: HandleFetch = async ({ event, request, fetch }) => { const isApi = request.url.startsWith(apiUrl) || request.url.includes('/api/'); if (isApi) { + // If the request already carries an explicit Authorization header (e.g. the + // login action sends Basic auth), pass it through unchanged. + if (request.headers.has('Authorization')) { + return fetch(request); + } + const token = event.cookies.get('auth_token'); if (!token) {