How to set CallbackURL in emailVerification

I'm using BetterAuth for email verification in my app, and I need help setting the callbackURL for the emailVerification process. In my auth.ts file, I'm trying to send a verification email, but I can't figure out how to properly set the callbackURL that the user will be redirected to after clicking the confirmation link. How do I configure the callbackURL in the emailVerification setup in BetterAuth?
2 Replies
Glen Kurio
Glen Kurio2w ago
You can specify the callback URL only when triggering sendVerificationEmail manually:
await authClient.sendVerificationEmail({
callbackURL: "/" // The redirect URL after verification
})
await authClient.sendVerificationEmail({
callbackURL: "/" // The redirect URL after verification
})
https://www.better-auth.com/docs/concepts/email#3-manually
Email | Better Auth
Learn how to use email with Better Auth.
Glen Kurio
Glen Kurio2w ago
Otherwise callback in signUp/In.email is used to redirect user after successful email verification

Did you find this page helpful?