Block suspicious IP addresses
Registration security
Kinde · Const
Kinde’s user:pre_registration workflow runs after single-factor authentication and before a user record is created. Use it to validate registration inputs or block risky sign-ups.
A pre-registration workflow runs after single-factor authentication but before Kinde creates the user record. It receives the workflow event and can inspect registration data, then use the authentication binding to deny access when validation or business rules fail.
Trigger: `user:pre_registration`import { denyAccess } from "kinde-workflows";
export default async function workflow(event) {
const email = event.request.user.email;
const disposable = ["mailinator.com", "tempmail.com"];
if (disposable.some((domain) => email.endsWith(`@${domain}`))) {
denyAccess("Disposable email addresses are not allowed");
}
return event;
}Rejects registrations when the submitted email belongs to a known disposable-email domain.
Registration security
Spam prevention
Business validation
It fires on the user:pre_registration trigger after single-factor authentication and before a Kinde user record exists. This makes it suitable for validating registration data before account creation.
Follow-up: What authorization checks have happened at this point? Organization access and MFA have not been checked, so later workflow stages or the normal authentication flow must still handle them.
The workflow receives an event object with request and context keys. These provide the trigger reason and additional data that the workflow can use when deciding whether registration should proceed.
Follow-up: How would you inspect a submitted email? Read the relevant value from the request data, then apply a validation rule before allowing the registration to continue.
A common use is blocking registrations from suspicious IP addresses or refusing disposable email addresses. The workflow can apply these rules before Kinde creates the user record.
Follow-up: How could a product use this for fraud prevention? It could call an external fraud or reputation service and deny access when the returned risk assessment exceeds the product's threshold.
user:post_authenticationuser:pre_mfakinde.authdenyAccess