diff --git a/apps/hackathon/src/app/auth/callback/page.tsx b/apps/hackathon/src/app/auth/callback/page.tsx index 7122242..6100e37 100644 --- a/apps/hackathon/src/app/auth/callback/page.tsx +++ b/apps/hackathon/src/app/auth/callback/page.tsx @@ -25,20 +25,32 @@ const CallbackPage: FC = (): ReactElement => { const type = hashParams.get('type') || urlParams.get('type'); const accessToken = hashParams.get('access_token') || urlParams.get('access_token'); - // Handle email confirmation callback from Supabase - if (type === 'signup' || type === 'email_confirmation' || type === 'recovery') { - // Don't auto sign in - redirect to login with success message + // Debug: log what we received + console.log('[Callback] Params:', { type, accessToken: !!accessToken, hash: globalThis.location.hash, search: globalThis.location.search }); + + // Handle Supabase email callbacks (has access_token in hash or query) + // This includes: signup confirmation, email confirmation, password recovery + if (accessToken) { setIsProcessing(false); - if (type === 'recovery') { - // Password reset - redirect to reset password page + // Password recovery - type is 'recovery' or we have access_token from reset email + if (type === 'recovery' || type === 'magiclink') { toast.success('Email verified! Please set your new password.'); - navigate('/auth/reset-password' + (accessToken ? `?access_token=${accessToken}` : '')); - } else { - // Email confirmation for signup + navigate('/auth/reset-password?access_token=' + accessToken); + return; + } + + // Signup/Email confirmation + if (type === 'signup' || type === 'email_confirmation') { toast.success('Email verified successfully! Please log in to continue.'); navigate('/auth/login'); + return; } + + // If we have access_token but unknown type, assume it's password recovery + // (Supabase sometimes sends without explicit type) + toast.success('Email verified! Please set your new password.'); + navigate('/auth/reset-password?access_token=' + accessToken); return; } @@ -78,6 +90,12 @@ const CallbackPage: FC = (): ReactElement => { }, []); if (error) { + // Check if error is related to private email + const isPrivateEmailError = + error.toLowerCase().includes('failed to create user') || + error.toLowerCase().includes('email') || + error.toLowerCase().includes('user record'); + return (
{error}
+ GitHub login requires a public email address. Please follow these steps: +
++ Alternatively, you can sign up using email and password instead. +
+Redirecting to login page in 3 seconds...
diff --git a/libs/service/src/hooks/auth/index.ts b/libs/service/src/hooks/auth/index.ts index ff8e87c..2d41e37 100644 --- a/libs/service/src/hooks/auth/index.ts +++ b/libs/service/src/hooks/auth/index.ts @@ -272,12 +272,9 @@ export const useEmailAuth = () => { const signUpWithEmail = async (email: string, password: string, fullname: string) => { const result = await signupMutation.mutateAsync({ email, password, fullname }); + // Signup only returns a message (user needs to verify email first) return { - user: result.user, - session: { - access_token: result.token.access_token, - refresh_token: result.token.refresh_token, - }, + message: result.message, }; };