# Testing magic links from within app

To test Stytch (or any provider's) magic links end to end in your own app, Humanless receives the real email and returns the link: create a disposable inbox, start the login with its address, call `waitForLink`, and open the URL in the same browser so your redirect handler can authenticate the token. Humanless parses messages and never opens links, so it won't consume a single-use token the way some corporate email scanners do. Your users' mailboxes might, though, so consider a confirmation click on the landing page. Stytch's test environment also offers sandbox values for tests that don't need real email.

```ts stytch-magic-link.spec.ts
await page.getByLabel("Email").fill(email!);
const since = Date.now();
await page.getByRole("button", { name: "Continue with email" }).click();
const { url } = await hl.waitForLink({ identityId: identity_id, since, timeout: 25 });
await page.goto(url); // your redirect URL receives the token and calls Stytch to authenticate it
await expect(page.getByText("Signed in")).toBeVisible();
```

## Other options

- **Stytch sandbox values**: in the test environment, documented sandbox emails and tokens return fixed results without sending email.
- **A real test mailbox** read through IMAP or the Gmail API.
- **Mailosaur or MailSlurp** as the inbox.

> **Use policy:** Only for apps you own or are authorized to test. See the [Terms](/terms).

More: [How to test magic link login end to end](/guides/magic-link-testing) · [All answers](/answers/)

Last updated 2026-12-04

Canonical: https://usehumanless.com/answers/testing-magic-links-from-within-app

---
More: https://usehumanless.com/llms.txt
