Supabase Auth: magic link returns to the wrong address after clicking
The login link redirects to localhost or unexpected address instead of a production application. RedirectTo and the list of allowed addresses in Auth configuration must match the real domain.
How to determine the source of the error
Check Site URL, Redirect URLs and redirectIt is transmitted when generating a link.
Distinguish preview domain from production and verify HTTPS protocol and callback end path.
What to do step by step
1. Add the exact callback production address to allowlist and set the correct Site URL for implementation.
2 . In the callback support code, safely replace the code for the session, then redirect to a limited set of permitted routes.
How to check the score
Upon clicking the new link, the user hits the right domain and is logged in.
What to do
Do not use an open redirection to any URL provided by the user.