// auth and identity
Via APIFusionAuth email verification with pingutil
FusionAuth's hosted registration form accepts any well-formed address, and spam sign-ups are a common complaint in its community forum. A Self-Service Registration Validation lambda runs when the form is submitted; with Lambda HTTP Connect it can call pingutil and add a field error on user.email, so the user sees the message right next to the field.
Where it connects: FusionAuth Self-Service Registration Validation lambda with Lambda HTTP Connect
What goes wrong without it
- Bots fill our FusionAuth registration form with random addresses at throwaway domains.
- We want the error to appear on the form, next to the email field, not on a generic error page.
- Writing and updating a domain blocklist inside a lambda is not something anyone wants to own.
What you can do with FusionAuth and pingutil
Field error for disposable addresses
Set result.errors.fieldErrors['user.email'] when verdict.is_spam is true. FusionAuth re-renders the form with your message on the email field.
Catch scripted sign-ups on unknown domains
email_signals.is_randomized flags bot-style local parts even on domains no list knows about yet.
Theme-driven messages
Leave out the message and use a code like [blocked]user.email, then define the text per locale in your FusionAuth theme.
Set it up
- 1
Confirm your plan includes Lambda HTTP Connect (FusionAuth lists it as requiring at least Essentials).
- 2
Under Customizations > Lambdas, create a lambda of type Self-Service Registration Validation with the code below.
- 3
Select the lambda in the application's registration settings for self-service registration.
- 4
Replace the placeholder key, ideally with a lambda secret on FusionAuth 1.64 or later.
- 5
Register with a disposable address and confirm the field error appears.
// FusionAuth lambda: fetch() is synchronous and returns { status, body }.
function validate(result, user, registration, context) {
if (!user || !user.email) return; // email not on this step
var response;
try {
response = fetch('https://pingutil.com/v1/lookup', {
method: 'POST',
headers: {
'Authorization': 'Bearer pk_live_your_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({ input: user.email, skip_enrichment: true }),
connectTimeout: 1000,
readTimeout: 1500
});
} catch (e) {
console.info('pingutil unavailable, allowing registration');
return; // fail open
}
if (response.status !== 200) return;
var data = JSON.parse(response.body);
if (data.verdict && data.verdict.is_spam) {
result.errors.fieldErrors['user.email'] = [{
code: '[blocked]user.email',
message: 'Please register with a permanent email address.'
}];
}
}What to do with each result
| pingutil result | Action in FusionAuth |
|---|---|
| verdict.is_spam: true | Add a fieldErrors entry on user.email; the form re-renders with the message |
| verdict.low_trust: true | Allow; log with console.info for review in the event log |
| category: "company" or "free" | Allow |
| Timeout, non-200 or exception | Return without errors (fail open) |
Limits to plan for
- Lambda HTTP Connect needs at least a FusionAuth Essentials plan. Lambda HTTP calls default to 2-second connect and read timeouts, which fast mode fits easily.
- The lambda only covers self-service registration forms. Users created through the API or imports skip it.
- Do not run a full mailbox check here; a slow mail server would hit the lambda timeout and the result would be discarded anyway.
FusionAuth documentation
- fusionauth.io/docs/extend/code/lambdas/self-service-registration
- fusionauth.io/docs/extend/code/lambdas/lambda-remote-api-calls
FusionAuth is a trademark of its owner. This integration uses FusionAuth's documented extension points; it is not an official FusionAuth app.
Common questions
- Why is fetch synchronous in the snippet?
- FusionAuth lambdas expose fetch synchronously. Per FusionAuth's docs, the response has status and body but no json() method, so the code parses body with JSON.parse.
- Can I check a multi-step registration form?
- Yes. The lambda runs on each step, and the early return skips steps where the email is not present, as FusionAuth's own example does.
Stop bad addresses in FusionAuth 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 FusionAuth setup will receive.