> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Auth0

> Client-mode REST API connector for a curated Auth0 Management API v2 slice: list users and create a user

Technical Preview

# Auth0

Client-mode REST API connector for a curated Auth0 Management API v2 slice: list users and create a user.

* Hub category: **Identity**.
* Base: `https://tenant.us.auth0.com`

## Template reference

Generated from the shipped broker template `auth0` (`-routeCode AUTH0`). It lists every event the template defines.

### Auth

Auth headers used by the template: `Authorization: Bearer {value.json.api_token}`.

### Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Auth0 connector | no |
| `BaseUrl` | string | Auth0 base URL without trailing slash (e.g. [https://tenant.us.auth0.com](https://tenant.us.auth0.com)) | yes |

`BASE_ADDRESS` default: `https://tenant.us.auth0.com`.

### Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `Listusers` | GET | `/api/v2/users` | `identity/auth0/users/list` | `identity/auth0/users/list/response` | `api_token` |
| `Createuser` | POST | `/api/v2/users` | `identity/auth0/users/create` | `identity/auth0/users/create/response` | `api_token`, `body` |
| `Getuser` | GET | `/api/v2/users/{value.json.user_id}` | `identity/auth0/users/get` | `identity/auth0/users/get/response` | `api_token`, `user_id` |

### Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode AUTH0"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE Auth0RestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://tenant.us.auth0.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Listusers
        WITH SOURCE_TOPIC "identity/auth0/users/list"
        WITH DESTINATION_TOPIC "identity/auth0/users/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v2/users"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Createuser
        WITH SOURCE_TOPIC "identity/auth0/users/create"
        WITH DESTINATION_TOPIC "identity/auth0/users/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v2/users"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{value.json.body}"
    ADD EVENT Getuser
        WITH SOURCE_TOPIC "identity/auth0/users/get"
        WITH DESTINATION_TOPIC "identity/auth0/users/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v2/users/{value.json.user_id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

### Usage example

Call `Listusers` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'identity/auth0/users/list/response' &
mosquitto_pub -t 'identity/auth0/users/list' -m '{"api_token": "<api_token>"}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.