Skip to content

// auth and identity

Via API

Auth0 email verification with pingutil

Auth0 sends a verification email, but a temp-mail inbox receives it just fine, so throwaway accounts pass and farm your free tier. A Pre User Registration Action that calls pingutil checks the address before the user exists: disposable and dead mailboxes are denied with a message, risky ones are tagged in app_metadata for review.

Where it connects: Auth0 Actions, Pre User Registration trigger

What goes wrong without it

  • People sign up with 10-minute inboxes, click the Auth0 verification link and get a full trial account.
  • Users mistype gmail.con at sign-up, never get the verification email and open a support ticket a week later.
  • Our user table fills with accounts nobody can reach, and the activation numbers we report are inflated by them.

What you can do with Auth0 and pingutil

  • Deny disposable addresses at registration

    pingutil returns status invalid with reason disposable_domain for addresses on its disposable list (about 9,900 domains, re-synced weekly). The Action calls api.access.deny and Auth0 never writes the user.

  • Catch typos before the verification email bounces

    When the domain looks like a typo of a major provider, did_you_mean carries the likely address. Put it in the deny message so the user can fix it on the same screen.

  • Tag risky accounts instead of blocking them

    Catch-all domains, role addresses and randomized local parts come back as risky. Store the reason in app_metadata and let later Actions or your backend limit trial credits for those users.

Set it up

  1. 1

    Create a pingutil API key in the pingutil dashboard.

  2. 2

    In the Auth0 Dashboard, go to Actions, create a custom Action on the Pre User Registration trigger and add a secret named PINGUTIL_KEY.

  3. 3

    Paste the code below, then deploy the Action.

  4. 4

    Add the Action to the Pre User Registration flow and save.

  5. 5

    Sign up with a disposable address on a test application and confirm the deny message appears.

Pre User Registration Action
/**
 * Auth0 Action, Pre User Registration trigger.
 * Secret: PINGUTIL_KEY (a pk_live_... key from pingutil.com/dashboard).
 */
exports.onExecutePreUserRegistration = async (event, api) => {
  const email = event.user.email;
  if (!email) return;

  let result;
  try {
    const res = await fetch('https://pingutil.com/v1/verify', {
      method: 'POST',
      headers: {
        authorization: 'Bearer ' + event.secrets.PINGUTIL_KEY,
        'content-type': 'application/json',
      },
      body: JSON.stringify({ email }),
      // Mailbox checks can take seconds on slow servers. Stay well inside
      // the Action time limit and let the sign-up through on timeout.
      signal: AbortSignal.timeout(4000),
    });
    if (!res.ok) return; // 429 or 5xx from pingutil: fail open
    result = await res.json();
  } catch (err) {
    console.log('pingutil unavailable, allowing sign-up:', err.name);
    return;
  }

  if (result.status === 'invalid') {
    const hint = result.did_you_mean ? ' Did you mean ' + result.did_you_mean + '?' : '';
    api.access.deny('invalid_email', 'We cannot use this email address.' + hint);
    return;
  }

  if (result.status === 'risky') {
    // catch-all domain, role address, randomized local part or full mailbox
    api.user.setAppMetadata('email_risk', result.reason);
  }
};

What to do with each result

pingutil resultAction in Auth0
status: "invalid", reason: "disposable_domain"api.access.deny with a message asking for a permanent address
status: "invalid" with did_you_mean setapi.access.deny and show the suggested address in the message
status: "risky"Allow, store reason in app_metadata.email_risk for later review
status: "unknown"Allow; the mail server gave no definitive answer
Timeout, 429 or 5xxReturn without calling api.access.deny (fail open)

Limits to plan for

  • Auth0 documents a 20-second limit per trigger execution. A mailbox check on a slow server can take much of that, so keep the 4-second timeout, or switch to POST /v1/lookup with skip_enrichment: true for a millisecond disposable and randomness check.
  • Pre User Registration runs for database and passwordless connections. Users who arrive through social or enterprise connections need a separate check, for example in a Post Login Action on first login.
  • Catch-all domains cannot be confirmed by any SMTP check. pingutil reports them as risky (accept_all), never valid.

Common questions

Should I use /v1/verify or /v1/lookup in the Auth0 Action?
Use /v1/verify when you want to catch dead mailboxes and typos and can accept a few seconds of latency on first-seen addresses. Use /v1/lookup with skip_enrichment set to true when you only need to block disposable and machine-generated addresses fast.
What happens if pingutil is down during a sign-up?
The code above catches the timeout or error and returns without denying, so Auth0 creates the user as it normally would. You lose the check for that sign-up, not the sign-up itself.

Stop bad addresses in Auth0 today

Sign in with your email, create an API key and paste it into the step above. Test on a few real addresses first: the live demo shows exactly what your Auth0 setup will receive.