diff --git a/app/components/SuperTokensAuthComponent.tsx b/app/components/SuperTokensAuthComponent.tsx index e0cb8c4..c4fa427 100644 --- a/app/components/SuperTokensAuthComponent.tsx +++ b/app/components/SuperTokensAuthComponent.tsx @@ -10,8 +10,14 @@ export default function SuperTokensAuthComponent() { const handleGoogleSignIn = async () => { setIsLoading(true); try { + // Get the base URL from environment or current window + const baseUrl = process.env.NEXT_PUBLIC_APP_URL || window.location.origin; + const redirectUri = `${baseUrl}/api/auth/callback/google`; + // Get Google OAuth URL from SuperTokens - const response = await fetch("/api/auth/authorisationurl?thirdPartyId=google"); + const response = await fetch( + `/api/auth/authorisationurl?thirdPartyId=google&redirectURIOnProviderDashboard=${encodeURIComponent(redirectUri)}` + ); const data = await response.json(); if (data.status === "OK") {