Why automate identity workflows
Automating identity-driven workflows is useful when you need to:- Onboard new employees into business applications the moment they are provisioned in your IdP.
- Update CRM contacts, SaaS licenses, or internal tools when user attributes change.
- Deprovision access across downstream systems when a user is removed.
- Remove manual steps from processes that depend on identity lifecycle events.
Architecture overview
The pipeline in this guide uses four components:- Corporate IdP (for example, Okta) — the source of truth for employee identities.
- Auth0 Inbound SCIM — receives provisioning events from the IdP and creates or updates users in Auth0.
- Event Stream with an Auth0 Action — listens for user lifecycle events and runs server-side code.
- External system (for example, HubSpot CRM) — the destination that receives the transformed data.
- An administrator assigns a user to an application in the corporate IdP.
- The IdP pushes the change to Auth0 through SCIM.
- Auth0 creates or updates the user profile and publishes an event.
- The Event Stream triggers an Action that calls the external system’s API.
Prerequisites
Before you begin, make sure you have:- An Auth0 tenant on an Enterprise plan with Events enabled.
- A corporate IdP that supports SCIM provisioning (for example, Okta or Microsoft Entra ID).
- Auth0 Inbound SCIM configured for the relevant connection. To learn more, read Inbound SCIM.
- An API key or OAuth credentials for the external system you plan to call.
Set up SCIM provisioning
If you have not already configured Inbound SCIM, complete the following steps to connect your IdP to Auth0.- Okta
- Other IdPs
- In the Auth0 Dashboard, navigate to Authentication > Enterprise and select your SAML or OIDC enterprise connection.
- Select the Provisioning tab and enable Inbound SCIM.
- Generate a SCIM token and copy it.
- In Okta, open the application you use to federate with Auth0.
- Select the Provisioning tab, then select Configure API Integration.
- Enable the integration, paste the Auth0 SCIM endpoint URL and token, and select Save.
- Under To App, enable Create Users, Update User Attributes, and Deactivate Users.
Create the Event Stream Action
With SCIM provisioning active, Auth0 publishesuser.created, user.updated, and user.deleted events. Next, create an Event Stream with an Auth0 Action that forwards these events to your external system.
Create the Event Stream
- Navigate to Auth0 Dashboard > Event Streams.
- Select Create Event Stream.
- Select Auth0 Actions as the stream type.
- Enter a descriptive name (for example,
CRM Sync). - Subscribe to
user.created,user.updated, anduser.deleted.
Write the Action handler
In the Action editor, write a handler that maps each event type to the corresponding API call on your external system. The example below targets HubSpot CRM.Store the API key as a secret
- In the Action editor, select Secrets (the key icon).
- Add a secret named
HUBSPOT_TOKENwith the value of your HubSpot private app access token.
Save and deploy
Select Save Draft, then Deploy. The Action is now bound to your Event Stream and runs each time a subscribed event triggers.Verify the pipeline
- In your corporate IdP, assign a test user to the application connected to Auth0.
- Confirm the user appears in Auth0 under User Management > Users.
- Confirm a corresponding contact is created in your external system.
- Update the user’s name in the IdP and verify the change propagates to both Auth0 and the external system.
- Unassign the user from the application in the IdP. Confirm the user is deprovisioned in Auth0 and the contact is removed from the external system.
Extend the pattern
The architecture in this guide is not specific to HubSpot. You can apply the same pattern to any system with a REST API:- Salesforce — create or update leads and contacts.
- Segment — send
identifyandtrackcalls for downstream analytics. - Braze — update user profiles for marketing campaigns.
- Internal services — call internal microservices to provision accounts, assign licenses, or trigger onboarding workflows.