diff --git a/services/mana-auth/src/auth/better-auth.config.ts b/services/mana-auth/src/auth/better-auth.config.ts index 950da2542..246888be4 100644 --- a/services/mana-auth/src/auth/better-auth.config.ts +++ b/services/mana-auth/src/auth/better-auth.config.ts @@ -188,11 +188,12 @@ export function createBetterAuth(databaseUrl: string) { // during the verification process in the passthrough controller const sourceAppUrl = sourceAppStore.get(user.email); - // Modify verification URL to include redirectTo parameter + // Modify verification URL: set callbackURL so Better Auth redirects + // back to the source app after email verification let verificationUrl = url; if (sourceAppUrl) { const urlObj = new URL(url); - urlObj.searchParams.set('redirectTo', sourceAppUrl); + urlObj.searchParams.set('callbackURL', sourceAppUrl); verificationUrl = urlObj.toString(); }