Full Page Reload After Forgot Password When Using redirectTo Package: @daveyplate/better-auth-ui Ver

When using redirectTo={domain} with React Router and the built-in forgot-password flow, a full page reload is triggered after submitting the form and the email is sent.

This causes an unwanted reload (flicker) and breaks client-side navigation.

Expected Behavior
After a successful forgot-password request:

I should stay on the /auth/forgot-password page, or

Be redirected to /auth/sign-in via React Router navigation without a full page reload.

Steps to Reproduce
Wrap app in using:

<AuthUIProvider
authClient={authClient}
redirectTo={window.location.origin}
replace={(path) => navigate(path, { replace: true })}
Link={({ href, ...props }) => <NavLink to={href} {...props} />}

{children}

Navigate to /auth/forgot-password

Submit valid email

Observe: full page reload to /auth/sign-in

Investigation
The reload is triggered because redirectTo builds a full URL (http://localhost:3000/auth/sign-in), which then gets passed back into window.location.href = ..., causing a hard reload.

Even when replace is implemented, it's bypassed in favor of redirectTo.

Proposed Fix
One of the following would help:

Provide a lifecycle hook (like onForgotPasswordSuccess) to override the redirect.

Allow redirectTo to be respected only for actual link-building, not for internal redirects after submission.

Make replace() intercept even full redirectTo URLs like http://localhost:3000/auth/sign-in.
Was this page helpful?