Auth0
// Auth0 Pre-user Registration Action
exports.onExecutePreUserRegistration = async (event, api) => {
const email = event.user.email;
try {
const response = await fetch(
`https://api.disposableguard.com/v1/check?email=${encodeURIComponent(email)}`,
{
headers: {
Authorization: `Bearer ${event.secrets.DG_KEY}`,
},
}
);
if (response.ok) {
const data = await response.json();
if (data.is_disposable) {
api.access.deny("Please use a real email address.");
}
}
} catch {
// fail-open
}
};Notes
Add `DG_KEY` as a secret in the Auth0 Action. Deploy and attach to the Pre-user Registration flow.