This module allows synchronizing users from Auth0 Identity Cloud.
The process is carried out through a Machine-to-Machine (M2M) application authorized to query the management API. It is efficient for large user bases thanks to asynchronous export jobs.
Part 1: Configuration in the Auth0 Dashboard
To access the management API, we need to create a specific "machine" application for Anjana.
Step 1: Create the M2M application
-
Log in to your Auth0 admin dashboard.
-
Go to Applications > Applications.
-
Click Create Application.
-
Assign a name (e.g.
Anjana Provisioning Service). -
Select the type Machine to Machine Applications.
-
Click Create.
Step 2: Authorize the Management API
After creating the app, Auth0 will ask which API you want to authorize.
-
In the "Select an API" dropdown, choose Auth0 Management API.
-
In the permissions list (Scopes), find and select:
-
read:users(Allows reading users and creating export jobs).
-
-
Click Authorize.
Step 3: Get credentials
-
Once authorized, go to the Settings tab of the created application.
-
Copy the following values:
-
Domain: (e.g.
dev-xyz.us.auth0.com). -
Client ID.
-
Client Secret.
-
Part 2: Configuration in application.yml of the Zeus microservice
Edit Anjana's configuration file and include the data in the security.provisioning.providers.auth0 section.
security:
provisioning:
providers:
auth0:
# Unique key for this data source (e.g: auth0-main-tenant)
auth0-main-tenant:
# Your tenant's domain (without https://)
domain: "dev-xyz.us.auth0.com"
# Client ID of the M2M App (Step 3)
client-id: "A1b2C3d4..."
# Client Secret of the M2M App (Step 3)
client-secret: "secret_value_..."
Property summary
|
YAML Property |
Description |
Source in Auth0 |
|
|
Tenant domain. |
Applications > Settings > Domain |
|
|
Identifier of the M2M App. |
Applications > Settings > Client ID |
|
|
Secret of the M2M App. |
Applications > Settings > Client Secret |
Custom field mapping (field-mapping)
Anjana includes a default mapping that covers common cases. You can override any field by indicating the Auth0 profile key from which the value should be read. The keys are lists in order of priority: the first non-empty value is used.
User metadata (user_metadata and app_metadata) is exposed with the prefix user_metadata. and app_metadata. respectively. For example, if you have user_metadata.department, you can reference it directly in field-mapping.
Default mapping
|
Anjana Field |
Default keys (priority order) |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Available fields
|
Key |
Description |
|---|---|
|
|
Unique identifier of the user in Auth0 (e.g. |
|
|
Username (only available if the User Pool has usernames enabled). |
|
|
Email address. |
|
|
First name. |
|
|
Last name. |
|
|
Full name. |
|
|
Nickname. |
|
|
URL of the user's avatar. |
|
|
Phone number. |
|
|
Any |
|
|
Any |
Configuration example
security:
provisioning:
providers:
auth0:
auth0-main-tenant:
domain: "dev-xyz.us.auth0.com"
client-id: "..."
client-secret: "..."
field-mapping:
# Use given_name; if empty, use full name
first-name: ["given_name", "name"]
# Read position from user_metadata.position, with fallback to user_metadata.title
title: ["user_metadata.position", "user_metadata.title"]
# Direct phone or from metadata
phone: ["phone_number", "user_metadata.phone_number"]