From d23ef52839d2389e770fc86c465e04ebf985d4bd Mon Sep 17 00:00:00 2001 From: Till JS Date: Tue, 31 Mar 2026 18:34:56 +0200 Subject: [PATCH] fix(mana-auth): set callbackURL instead of redirectTo for email verification redirect Better Auth uses callbackURL to determine the post-verification redirect target. Setting only redirectTo left callbackURL=/ which resolved to auth.mana.how/ (404). Co-Authored-By: Claude Sonnet 4.6 --- services/mana-auth/src/auth/better-auth.config.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(); }