Setting up automated testing for Email Magic Links product

We’re using the Email Magic Links product and would like to set up some automated testing, but we’re not sure if this is possible since we need the token from the actual email that’s sent. Is there any way to get around this without working around the login flow entirely?

Hey Diana – thanks for posting!

I’d recommend checking out our sandbox values that we designed with this use case in mind. For our Email Magic Links endpoints, you can use the email address sandbox@stytch.com to trigger a 200 response without actually sending an email.

You can then use the following tokens in your /magic_links/authenticate call to trigger the following responses:

  • 200 success: DOYoip3rvIMMW5lgItikFK-Ak1CfMsgjuiCyI7uuU94=
  • 401 unable_to_auth_magic_link: 3pzjQpgksDlGKWEwUq2Up--hCHC_0oamfLHyfspKDFU=
  • 404 magic_link_not_found: CprTtwhnRNiMBiUS2jSLcWYrfuO2POeBNdo5HhW6qTM=

Happy to help with any follow-up questions you have about this!

That’s perfect, thanks!