Skip to main content
Auth0 Actions allow you to customize authentication with custom code. When using multiple custom domains, you can access custom domain information in your Actions to implement domain-specific logic, route users to organizations, enforce access policies, and customize notifications.

Accessing custom domain information

Actions provide access to custom domain information through the event.custom_domain object. This object contains the domain name and any metadata configured for that domain.

Available triggers

The event.custom_domain object is available in the following Action triggers:
The event.custom_domain object is only available in triggers where the request originates from a custom domain context. If no custom domain was used, this property will be undefined.

Event object structure

Using login.example.com domain configured with domain metadata:
Would log at the console:

Common use cases

Conditional logic by domain

Apply different rules based on whether a custom domain or canonical domain is used:

Email domain-based access control

Enforce email domain-specific access policies using custom domain metadata:

Application metadata-based access control

Enforce application and domain groups access policies using application and domain metadata:

Connection metadata-based access control

Enforce connection and domain groups access policies using connection and domain metadata:

Organization metadata-based access control

Enforce organization and domain groups access policies using organization and domain metadata:

Region-based requests

Make requests to region-specific external services based on custom domain metadata:

Learn more

Actions documentation

Event object references