// auth and identity
Via APILogto email verification with pingutil
Logto's PostRegister webhook fires after a user finishes sign-up, so it cannot stop the account from being created, but it can act seconds later. Your endpoint verifies the address with pingutil and suspends users with invalid mailboxes through the Management API; on Logto Cloud, the built-in disposable email blocklist handles the known throwaway domains at the door.
Where it connects: Logto webhooks, PostRegister event (after sign-up), with the Management API to suspend users
What goes wrong without it
- Our Logto user list fills with accounts whose verification emails bounce.
- We turned on the disposable blocklist, but dead mailboxes and random-string addresses at real domains still get through.
- Logto has no documented sign-up hook that waits for our answer, so we need something that acts right after registration.
What you can do with Logto and pingutil
Suspend users whose mailbox does not exist
On PostRegister, call /v1/verify with user.primaryEmail. When status is invalid (mailbox_not_found, no_mx, disposable_domain), PATCH /api/users/{userId}/is-suspended with isSuspended: true.
Flag risky sign-ups for review
Catch-all domains, role addresses and randomized local parts come back as risky. Write the reason to your own database or the user's custom data instead of suspending.
Route work-email users to sales
Call /v1/lookup for the same address and send category company sign-ups, with company.name, to your CRM or sales channel.
Set it up
- 1
On Logto Cloud, turn on disposable email blocking in Console > Security > Blocklist first, so known throwaway domains never register.
- 2
Create a machine-to-machine application with access to the Logto Management API and note its client ID and secret.
- 3
Deploy the endpoint below with PINGUTIL_KEY, LOGTO_ENDPOINT, LOGTO_M2M_ID, LOGTO_M2M_SECRET and LOGTO_SIGNING_KEY set.
- 4
In the Logto Console, create a webhook for the PostRegister event pointing at your endpoint, and copy its signing key into LOGTO_SIGNING_KEY.
- 5
Register with an address at a domain that does not accept mail and confirm the user shows as suspended.
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
const app = express();
const LOGTO = process.env.LOGTO_ENDPOINT!; // e.g. https://your-tenant.logto.app
async function managementToken(): Promise<string> {
const res = await fetch(LOGTO + '/oidc/token', {
method: 'POST',
headers: {
authorization: 'Basic ' + Buffer.from(process.env.LOGTO_M2M_ID + ':' + process.env.LOGTO_M2M_SECRET).toString('base64'),
'content-type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({ grant_type: 'client_credentials', resource: LOGTO + '/api', scope: 'all' }),
});
return (await res.json()).access_token;
}
app.post('/logto/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
const expected = createHmac('sha256', process.env.LOGTO_SIGNING_KEY!).update(req.body).digest('hex');
const got = req.get('logto-signature-sha-256') ?? '';
if (got.length !== expected.length || !timingSafeEqual(Buffer.from(got), Buffer.from(expected))) {
return res.status(401).end();
}
res.status(200).end(); // answer first; the check runs after
const payload = JSON.parse(req.body.toString('utf8'));
const email: string | undefined = payload.user?.primaryEmail;
if (payload.event !== 'PostRegister' || !email || !payload.userId) return;
try {
const r = await fetch('https://pingutil.com/v1/verify', {
method: 'POST',
headers: { authorization: 'Bearer ' + process.env.PINGUTIL_KEY, 'content-type': 'application/json' },
body: JSON.stringify({ email }),
signal: AbortSignal.timeout(30000), // not on the user's path, so it can wait
});
if (!r.ok) return; // 429 or 5xx: leave the user active
const v = await r.json();
if (v.status !== 'invalid') return;
await fetch(LOGTO + '/api/users/' + payload.userId + '/is-suspended', {
method: 'PATCH',
headers: { authorization: 'Bearer ' + (await managementToken()), 'content-type': 'application/json' },
body: JSON.stringify({ isSuspended: true }),
});
console.log('suspended', payload.userId, v.reason);
} catch (err) {
console.error('pingutil check failed, user left active', err);
}
});
app.listen(3000);What to do with each result
| pingutil result | Action in Logto |
|---|---|
| status: "invalid" (mailbox_not_found, no_mx, disposable_domain) | PATCH /api/users/{userId}/is-suspended with isSuspended: true |
| status: "risky" | Leave active; record the reason for review |
| status: "valid" | No change |
| status: "unknown" | No change; re-check later if it matters |
| Timeout, 429 or 5xx | Leave the user active (fail open) |
Limits to plan for
- PostRegister fires after the account exists, so this is a cleanup step, not a block: the user can sign in until the suspension lands. Logto's documented pre-sign-up controls are the built-in blocklist rules, which do not call external services.
- Logto retries webhook deliveries when your endpoint answers with 500 or above, so respond 200 quickly and do the check afterwards, as the example does. PostRegister covers sign-ups through the Logto UI; users created through the Management API raise a different event.
- Each new user counts toward 300 verified addresses a day (3,000 a month) per account. Those are Free plan limits; Enterprise has custom limits.
Logto documentation
- docs.logto.io/developers/webhooks/webhooks-events
- docs.logto.io/developers/webhooks/webhooks-request
- docs.logto.io/security/blocklist
Logto is a trademark of its owner. This integration uses Logto's documented extension points; it is not an official Logto app.
Common questions
- Can Logto block a sign-up based on pingutil's answer?
- Not through a documented sign-up hook. Logto webhooks fire after registration and do not wait for your verdict. You can block known disposable domains up front with Logto's blocklist and suspend invalid mailboxes right after sign-up with the webhook.
- Why /v1/verify here and not the faster lookup?
- The webhook is not on the user's path, so a few seconds of mailbox checking costs nothing in sign-up latency, and it catches dead mailboxes and typos that a disposable check cannot.
Stop bad addresses in Logto 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 Logto setup will receive.