From 1daac47951631a43f0652cb92109cf94745599ba Mon Sep 17 00:00:00 2001 From: Fusion Date: Mon, 18 May 2026 10:56:27 +0200 Subject: [PATCH] fix: use full API URL for OAuth login redirects In Traefik deployment, API and web are on different domains. Frontend was using relative paths (/auth/login) which resolved to the web domain instead of the API domain. - Update LoginRedirectPage to use VITE_API_BASE_URL for login link - Update apiClient 401 interceptor to redirect to full API URL - Ensures OAuth flow works correctly with separate domains --- apps/web/src/api/client.ts | 2 +- apps/web/src/pages/placeholder.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/api/client.ts b/apps/web/src/api/client.ts index f4754aa..8167416 100644 --- a/apps/web/src/api/client.ts +++ b/apps/web/src/api/client.ts @@ -19,7 +19,7 @@ apiClient.interceptors.response.use( (error) => { const status = error?.response?.status; if (status === 401 && !shouldSkipAuthRedirect(window.location.pathname)) { - window.location.assign("/auth/login"); + window.location.assign(`${BASE_URL}/auth/login`); } return Promise.reject(error); } diff --git a/apps/web/src/pages/placeholder.tsx b/apps/web/src/pages/placeholder.tsx index 6c11137..6c55291 100644 --- a/apps/web/src/pages/placeholder.tsx +++ b/apps/web/src/pages/placeholder.tsx @@ -16,6 +16,8 @@ export const NotFoundPage = () => { ); }; +const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ?? "http://localhost:8000"; + export const LoginRedirectPage = () => { const nextPath = new URLSearchParams(window.location.search).get("next") ?? "/"; const encodedNext = encodeURIComponent(nextPath); @@ -24,7 +26,7 @@ export const LoginRedirectPage = () => {

Sign in required

You need to authenticate to access this section.

- + Continue to login