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 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-16 00:23:46 +07:00
co-authored by Claude
parent 6ba3deb149
commit fc832b404e
+4 -2
View File
@@ -29,8 +29,10 @@ export function AuthForm({ mode, isSubmitting, error, googleOAuthEnabled, onSubm
const handleGoogleLogin = useCallback(async (e: React.MouseEvent) => { const handleGoogleLogin = useCallback(async (e: React.MouseEvent) => {
e.preventDefault(); e.preventDefault();
const platform = isTauri() ? 'tauri' : 'web'; const platform = isTauri() ? 'tauri' : 'web';
const base = window.location.origin; // Use API base URL, not window.location.origin — on Tauri Android
const googleUrl = `${base}/api/v1/auth/google?platform=${platform}`; // 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); await openUrl(googleUrl);
}, []); }, []);