Post User Registration Flow

The Post User Registration Flow runs after a user is added to a Database or Passwordless Connection.

Diagram of the Actions Post User Registration Flow.

Actions in this flow are non-blocking (asynchronous), which means the Auth0 pipeline will continue to run without waiting for the Action to finish its execution. Thus, the Action's outcome does not affect the Auth0 transaction.

Triggers

Post User Registration

The post-user-registration triggers runs after a user has been created for a Database or Passwordless connection. This trigger can be used to notify another system that a user has registered for your application. Multiple actions can be bound to this trigger, and the actions will run in order. However, these actions will be run asynchronously and will not block the user registration process.

References

Event object: Provides contextual information about the newly-created user.

Common use cases

Notify Slack when a new user registers

/**
 * @param {Event} event - Details about newly created user.
 */
exports.onExecutePostUserRegistration = async (event) => {
  const { IncomingWebhook } = require("@slack/webhook");
  const webhook = new IncomingWebhook(event.secrets.SLACK_WEBHOOK_URL);

  const text = `New User: ${event.user.email}`;
  const channel = '#some_channel';

  webhook.send({ text, channel });
};

Was this helpful?

/

Store the Auth0 user id in a remote system

A post-user-registration Action can be used to store the Auth0 user ID in a remote system.

const axios = require("axios");

/**
 * @param {Event} event - Details about registration event.
 */
exports.onExecutePostUserRegistration = async (event) => {
  await axios.post("https://my-api.exampleco.com/users", { params: { email: event.user.email }});
};

Was this helpful?

/