Understand How Auth0 Actions Work

Actions are secure, tenant-specific, versioned functions written in Node.js that execute at certain points within the Auth0 platform. Actions are used to customize and extend Auth0's capabilities with custom logic.

The processes that can be extended in this way are called flows. Each flow is made up of one or more triggers and represents the logical pipeline through which information moves during a single point in the Auth0 journey. Multiple Actions can be added to a trigger, with each Action executing in the order in which it was placed. Some triggers are executed synchronously, blocking the flow in which they are involved, and some are executed asynchronously, as indicated in the table below.

Actions are a cornerstone to our overall extensibility product at Auth0. With Actions, you can add essential custom logic to your login and identity flows specific to your needs. Actions also allow you to connect external integrations that enhance your overall extensibility experience. For example, you can add an Action to your login flow to verify credentials such as a License or Passport using a Marketplace Partner who specializes in identity proofing.

What can you do with Actions?

What an Action can do is determined by where it is executed within the Auth0 runtime environment.

Flow Runs Trigger(s) Execution Example Uses
Login As a user logs in. post-login Synchronous
  • Modify access and ID tokens
  • Call APIs to enrich user profiles or send notifications
  • Create authorization rules and make access decisions based on custom logic
  • Conditionally enable MFA
  • Redirect users to an external site
Machine to Machine When an access token is issued via the Client Credentials Flow. credentials-exchange Synchronous
  • Prevent tokens from being issued
  • Add custom claims to the access token
Password Reset After the user completes the first challenge, but before the user enters a new password. post-challenge Synchronous
  • Challenge a user with an additional MFA factor before allowing them to set a new password
  • Redirect the user to a third-party website/service, such as a custom MFA provider, before allowing them to set a new password
Pre User Registration Before a user is added to a Database or Passwordless Connection. pre-user-registration Synchronous
  • Prevent creation of a user in Auth0
  • Add custom app_metadata or user_metadata to a newly created user
Post User Registration After a user is added to a Database or Passwordless Connection. post-user-registration Asynchronous
  • Send a new user notification
  • Create a record in a CRM system
Post Change Password After a password is changed for a Database Connection user. post-change-password Asynchronous
  • Send an email to a user to notify them that their password has been changed
  • Call an API to revoke a user’s sessions in other systems after their password has been change
Send Phone Message To send a Phone or SMS message as part of a Custom MFA Provider. send-phone-message Synchronous Use a custom provider for sending MFA Phone or SMS messages

Key benefits of Actions

Improved developer experience

  • When editing an Action within the Auth0 Dashboard, you will have access to rich type information and inline documentation about what is possible within each trigger, which makes it easy to discover what capabilities each Trigger supports.

  • An Action can be edited and tested without affecting the version that is currently serving production traffic.

  • If an issue is found within an Action, it can be rolled back to a previous version.

Access to npm packages

Nearly all public npm packages are available to be used within Actions.

Observability

When Actions are executed, Auth0 will capture key metrics about them and link them to Auth0 Logs.

Multiple Actions on every trigger

Every Action trigger supports multiple independent Actions.

Get started

Learn more