All posts
    Integrations

    How to Test Auth0 Email Verification

    The Devmailr Team6 min read

    Auth0 handles authentication, but it still emails your users — a verification link on signup, password-reset links, and (if you enable it) passwordless login codes. Here’s how to test those flows automatically by pointing Auth0 at a disposable inbox and reading what it sends.

    What Auth0 emails

    By default, Auth0 verifies a new user’s email with a verification link— a “verify your account” message containing a link to click. It can also send passwordless login codesby email (a one-time code instead of a link) and password-reset links. So depending on your config, you’re catching either a link (primaryLink) or a code (extractedCodes) — a disposable inbox handles both.

    Sign up with a disposable address

    javascript
    const inbox = await createInbox(`auth0-${Date.now()}`)
    
    // drive Auth0 Universal Login (or the signup API) with the address
    await page.goto('https://your-app.com/signup')
    await page.getByLabel('Email').fill(inbox.address)
    await page.getByLabel('Password').fill('Sup3r-Secret-Pw!')
    await page.getByRole('button', { name: 'Sign up' }).click()

    (The createInbox/waitForEmail helpers come from the CI/CD guide.)

    Auth0’s verification email contains a link to confirm the address — grab primaryLink and visit it:

    javascript
    const email = await waitForEmail(inbox._id, 'subject=' + encodeURIComponent('verify'))
    await page.goto(email.primaryLink)
    await expect(page.getByText(/email verified|confirmed/i)).toBeVisible()

    primaryLink picks the main call-to-action over footer links. (Subjects are configurable in your Auth0 email template, so adjust the filter to match yours.)

    Testing passwordless email codes

    If you use Auth0 passwordless with the code option, the email carries a one-time code instead of a link. Read it from extractedCodes:

    javascript
    // request the passwordless code (send: 'code'), then:
    const email = await waitForEmail(inbox._id, 'has_code=true')
    const code = email.extractedCodes[0]
    // submit the code to /passwordless/verify to complete login

    Password reset

    Reset emails carry a link too — same pattern: waitForEmail primaryLink → visit → set a new password. The password-reset guide walks through the full flow and edge cases.

    Tips

    • Subjects and templates are configurable in Auth0 — filter by subject if you send several emails.
    • Use a unique inbox per test for parallel safety.
    • For pure-API assertions, pull the ticket token out of primaryLink’s query string.

    Related reading

    Try it in two minutes

    Create a disposable prefix@devmailr.app inbox over the API, send mail to it from your app, and read it in your tests. Free plan, no card required.