Examples: Common Use Cases
Common usage of events and hooks to modify the behavior of an authentication on Authgear
Allow signups only from inside the corporate network
export default async function (
e: EventUserPreCreate
): Promise<HookResponse> {
const allowedIp = "123.45.67.89"; // The IP address of the corporate network
if (e.context.ip_address == allowedIp) {
return {
is_allowed: true,
};
} else {
return {
is_allowed: false,
reason: "You are not allow to sign up to this organisation",
title: "Sign-up not allowed!",
};
}
}Allowing access for specific geo location
Allow access according to user roles for a certain application
Allow access according to email domain
Block login during weekends
Block user login according to authentication method
Enable bot protection under specific conditions
Adaptive MFA: Require MFA only for users with high risk
Advanced: Applying stricter rate limits for authentications for a certain IP range
Last updated
Was this helpful?