Events are currently available in Early Access.To learn more about Auth0’s product release cycle, review Product Release Stages.
- Sending emails to new customers to welcome them or ask them to verify their email address.
- Monitoring user lifecycle changes so that you can update CRM (customer relationship management) or billing systems.
Access Management API (optional)
Event streams can either be provisioned using the or the Auth0 Management API. If using the , before you can set up an event stream, you need to create a machine-to-machine (M2M) application and authenticate with a Management API token. For more information, review Management API Access Tokens.- Navigate to Dashboard > Applications > Applications and select Create Application.
- Enter a descriptive name for your application and choose Machine to Machine Applications. Then, select Create.
- Select the API you want to call from your application. In this case, use the Auth0 Management API.
-
Choose the permissions that you want to be issued as part of your application’s access token, then select Authorize. For testing purposes, select:
read:event_streams
create:event_streams
update:event_streams
delete:event_streams
read:event_deliveries
update:event_deliveries
create:users
- Navigate to the Settings tab to gather your Client ID, Client Secret, and Domain.
- Review Get Management API Access Tokens to retrieve and store your access token.
AWS EventBridge
The information below describes how you can create and enable an event stream using AWS EventBridge.EventBridge prerequisites
To use AWS EventBridge for event streams, you will need the following:-
AWS account
- Your AWS account must have permissions to use EventBridge. If you don’t have an account, sign up at https://aws.amazon.com/eventbridge/.
- AWS IAM permissions
- AWS EventBridge event bus
- AWS account ID & region
Create an event stream (EventBridge)
Event streams allow you to capture real-time changes within your Auth0 tenant and send them to an external system for processing.Before setting up an event stream, you need to identify the event types you want to monitor. Then, you will use your AWS account ID and region to set up your event stream, as demonstrated below.This example uses the Auth0 CLI to create an event stream that subscribes to the If successful, this call returns the following JSON with your event stream
user.created
event, which triggers whenever a new user is registered in your tenant.id
. New event streams are enabled by default.Webhooks
As an alternative to AWS EventBridge, you can use webhooks to facilitate event streams. To get started, first set up a webhook handler to receive real-time notifications when a specific event occurs. Then, you can create your event stream. You can either create a basic webhook handler by following the instructions below, or you can use an existing service such as:- Vercel
- Inngest
Webhook prerequisites
Ensure you have the following installed to properly write your webhook handler:node.js
jq
npm
ngrok
Write the webhook handler
-
Install
express
to yournode_modules
folder and yourpackage.json
dependencies. -
Install
dotenv
to your root directory to use a.env
file for storing environment variables. -
Create a
webhook.js
fle to receive theuser.created
event and store it in a database. -
In the root of your project, create a
.env
file and add your API token using: -
Start your server:
-
To test the Webhook, expose your webhook handler using a tool like ngrok:
This provides a public URL for your local webhook handler, for example:
Create an event stream (webhooks)
Event streams allow you to capture real-time changes within your Auth0 tenant and send them to an external system for processing. Before setting up an event stream, you need to identify the event types you want to monitor. You will then use your webhook handler to create an event stream, as demonstrated below.This example uses the Auth0 CLI to create an event stream that subscribes to the If successful, this returns the following JSON with your event stream
user.created
event, which triggers whenever a new user is registered in your tenant. The event data is then forwarded to a webhook endpoint for further processing.id
. New event streams are enabled by default.