When using Multiple Custom Domains with the Delegated Administration Extension, the Custom Domain Hook allows you to specify which custom domain should be used for user operations such as creating users, resetting passwords, verifying emails, and blocking users.Documentation Index
Fetch the complete documentation index at: https://docs-staging.auth0-mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Hook contract
- ctx: Context object containing information about the current request.
- method: The operation being performed (e.g.,
create,reset_password,verify_email,block_user). - payload: Data related to the operation (for
createmethod, contains user details like email). - request: Contains information about the request.
- originalUser: The user being operated on (for methods other than
create).
- originalUser: The user being operated on (for methods other than
- method: The operation being performed (e.g.,
- callback(error, result): Callback function to return the custom domain configuration.
- error: Error object if something went wrong, otherwise
null. - result: Object specifying the custom domain behavior:
- customDomain (string): The custom domain to use (e.g.,
'customone.example.com'). - useCanonicalDomain (boolean): Set to
trueto use the tenant’s canonical domain instead of a custom domain. - Return empty object
{}to delegate to the tenant’s default domain.
- customDomain (string): The custom domain to use (e.g.,
- error: Error object if something went wrong, otherwise
Supported methods
The Custom Domain Hook is invoked for the following user operations:- create: When creating a new user
- reset_password: When sending a password reset email
- verify_email: When sending an email verification link
- block_user: When blocking a user
Sample use
In this example, users from different email domains are routed to different custom domains. Users from a corporate domain use the canonical tenant domain, while all others use the tenant’s default domain.Notes
- If this hook is not configured, the Delegated Administration Extension will use the tenant’s default custom domain if one is configured, or the canonical domain otherwise.
- The custom domain returned must be a verified custom domain configured in your tenant. If you specify an invalid or unverified domain, the operation will fail.
- When using
useCanonicalDomain: true, emails and links will use your Auth0 tenant’s canonical domain (e.g.,YOUR_TENANT.auth0.comorYOUR_TENANT.REGION.auth0.com). - Returning an empty object
{}delegates the domain selection to the tenant’s default custom domain configuration.