Make stytch email me magic link to localhost

I have many redirect url links for different domains of the same website (mostly test domains) But there is an issue with a form(which crashes the page) that I want to troubleshoot and a possible clue might be that it apparently doesn’t happen when you are logged in on localhost rather than any of the domains. So I really want to log in at localhost to try and replicate this and move on from there. One of the domains is set as the default but when I change localhost to be the default it still sends me a magic link to that one domain. I therefore don’t really know what to do. Any help is appreciated! It’s probably an elementary question but I have no clue what to do.

Hey Kirill – thanks for posting!

You can specify which redirect URL the Magic Link should point to when you’re making the Stytch request to send the Magic Link.

If you’re using a backend Stytch integration, you can accomplish this by setting the login_magic_link_url and signup_magic_link_url values to your desired redirect URL (in your case, your localhost URL) when calling our Send Magic Link or Login or create User via Magic Link endpoints.

If you’re using our headless frontend SDK methods, you can accomplish this by setting those same parameters (login_magic_link_url and signup_magic_link_url) when calling the Magic Links send or Login or create methods.

Finally, if you’re using our pre-built UI components, you can accomplish this by setting the loginRedirectURL and signupRedirectURL values inside the emailMagicLinksOptions object inside of your UI config.

You’ll just need to make sure that you’ve added whatever redirect URL value you specify to the Redirect URLs tab in the Stytch Dashboard. If you specify the redirect URL value directly in your API requests (as described above), you won’t need to set it as a default.

I hope that helps! Please let us know if you have any questions about this.

Thank you! Exactly what I needed.

Perfect, my pleasure!