Integrations

Auth0

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

  1. Log in to your Auth0 admin dashboard.

  2. Go to Applications > Applications.

  3. Click Create Application.

  4. Assign a name (e.g. Anjana Provisioning Service).

  5. Select the type Machine to Machine Applications.

  6. Click Create.

Step 2: Authorize the Management API

After creating the app, Auth0 will ask which API you want to authorize.

  1. In the "Select an API" dropdown, choose Auth0 Management API.

  2. In the permissions list (Scopes), find and select:

    • read:users (Allows reading users and creating export jobs).

  3. Click Authorize.

Step 3: Get credentials

  1. Once authorized, go to the Settings tab of the created application.

  2. 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.

YAML
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

domain

Tenant domain.

Applications > Settings > Domain

client-id

Identifier of the M2M App.

Applications > Settings > Client ID

client-secret

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)

userName

username, email

email

email

firstName

given_name, name

lastName

family_name

phone

user_metadata.phone_number, phone_number

title

user_metadata.title

Available fields

Key

Description

userId

Unique identifier of the user in Auth0 (e.g. auth0|abc123).

username

Username (only available if the User Pool has usernames enabled).

email

Email address.

given_name

First name.

family_name

Last name.

name

Full name.

nickname

Nickname.

picture

URL of the user's avatar.

phone_number

Phone number.

user_metadata.*

Any user_metadata key with the prefix user_metadata. (e.g. user_metadata.title, user_metadata.department).

app_metadata.*

Any app_metadata key with the prefix app_metadata. (e.g. app_metadata.role).

Configuration example

YAML
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"]