Automated testing for magic links in B2B SaaS

We are trying to write some automated E2E tests for our user signup flows. We see these docs here: Sandbox testing values | Stytch authentication and are trying to use the suggested sandbox@stytch.com email address so as to not actually send an email. However, when calling the following nodejs SDK method:

const response = await client.magicLinks.email.loginOrSignup({
	organization_id: '...',
	email_address: 'sandbox@stytch.com',
})

it gives us the following error response:

StytchError: {"status_code":400,"request_id":"request-id-test-14xxxxxxx-4316-4b60-a1d4-82bxxxab26f8","error_type":"inactive_email","error_message":"The email provided has been marked as inactive by our email provider. This happens most often when the email is undeliverable due to a hard bounce.","error_url":"https://stytch.com/docs/api/errors/400#inactive_email"}

We assumed that the sandbox email shouldn’t get this error since an actual email isn’t being sent. Are these testing tools not enabled for B2B applications and only for consumer apps? Or is there something else we’re doing wrong?

Any help would be greatly appreciated. Thank you.

1 Like

Hey Zack,

The Sandbox testing values link only refers to our Consumer offerings - we don’t currently support Sandbox values for B2B. Sorry for the confusion here! We’ve heard this request before so I’ve added a +1 for that internal request to extend the sandbox@stytch.com functionality to B2B with the product team.

Additionally, the reason you’re seeing the inactive_email error is because you’re actually sending the EML to sandbox@stytch.com which is an inactive email address at this point.

In the meantime, how does creating or reusing an existing email address for testing purposes work for your E2E tests? You could generate a “+” modified version of an email address such as zack+stytchtesting@successfund.com.

Best,
Chaeyoon
Stytch Developer Success

Thanks Chaeyoon. We’re sad to hear that we can’t use the sandbox email for B2B apps. But we’ll figure out a workaround for now. Thank you for your response.

Hey Zack,

Sounds good - let us know if any other questions come up and we’ll be happy to help!