From fc832b404eef6caacbc4f64f30d1a40c64cec501 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Tue, 16 Jun 2026 00:23:46 +0700 Subject: [PATCH] fix(auth): use VITE_API_BASE_URL for Google OAuth redirect instead of window.location.origin On Tauri Android, window.location.origin = http://tauri.localhost which is the embedded dev server URL, not the API server. Use VITE_API_BASE_URL env var which points to the production API. Co-Authored-By: Claude --- apps/web/src/components/auth-form.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/auth-form.tsx b/apps/web/src/components/auth-form.tsx index c29fa05..bd41e60 100644 --- a/apps/web/src/components/auth-form.tsx +++ b/apps/web/src/components/auth-form.tsx @@ -29,8 +29,10 @@ export function AuthForm({ mode, isSubmitting, error, googleOAuthEnabled, onSubm const handleGoogleLogin = useCallback(async (e: React.MouseEvent) => { e.preventDefault(); const platform = isTauri() ? 'tauri' : 'web'; - const base = window.location.origin; - const googleUrl = `${base}/api/v1/auth/google?platform=${platform}`; + // Use API base URL, not window.location.origin — on Tauri Android + // the origin is http://tauri.localhost which is not the API server. + const apiBase = import.meta.env.VITE_API_BASE_URL || window.location.origin; + const googleUrl = `${apiBase}/api/v1/auth/google?platform=${platform}`; await openUrl(googleUrl); }, []);