access_token — authorizes the authentication service, including the refresh endpoint itself.ejento_access_token — authorizes your calls to the Ejento AI API (chat, agents, corpora, and so on).access_token for a fresh pair of tokens before that happens — without asking the user to log in again.access_token and an ejento_access_token.In short: You only call the Azure AD login endpoint once, during initial setup. Store the returned access_tokenandejento_access_token— from here on, use theejento_access_tokento call the Ejento API and theaccess_tokento refresh. You do not log in again: instead, call the refresh endpoint at least once every 6 days to obtain a fresh pair before the current tokens expire, and replace your stored tokens with the new ones. This keeps your session alive indefinitely without repeating the login step.
azure_ad_token used below comes from Microsoft's Authentication Library (MSAL). In short: configure MSAL with your Azure AD application, sign the user in, and acquire a token for your scope.Note: The snippet below is only an example. If you already obtain Azure AD tokens some other way, keep using your existing approach — all Ejento needs is a valid azure_ad_token.
@azure/msal-node instead. See Microsoft's MSAL documentation for full setup.{
"email": "[email protected]",
"azure_ad_token": "<azure-ad-token>",
"full_name": "Jane Doe", // optional
"auto_create": true, // optional
"organization_id": "<organization-id>" // optional
}| Field | Required | Description |
|---|---|---|
email | Yes | The user's email address. |
azure_ad_token | Yes | The token issued by Microsoft Azure AD. |
full_name | No | Used when creating a new user. |
auto_create | No | Create the user automatically if they do not exist. |
organization_id | No | The organization to associate the user with. |
200 OK{
"access_token": "<access token>",
"ejento_access_token": "<ejento access token>",
"token_type": "bearer"
}access_token and ejento_access_token. As described above, this login step happens only once — from here on you keep your session alive with the refresh endpoint.| Header | Value | Description |
|---|---|---|
Authorization | Bearer {access_token} | Your current access_token. This is what the endpoint authenticates. |
Ocp-Apim-Subscription-Key | {API_KEY} | Your API key. |
access_token in the Authorization header.200 OK{
"success": true,
"message": "Token refreshed",
"data": {
"access_token": "<new access token>",
"ejento_access_token": "<new ejento access token>",
"token_type": "bearer"
}
}data. The old tokens should no longer be used.| Status | Meaning | What to do |
|---|---|---|
401 Unauthorized | The access_token is invalid or has fully expired. | The session cannot be renewed. Send the user back through the login flow. |
422 Unprocessable Entity | The request was malformed. | Check the Authorization header format and the API key. |
access_token and ejento_access_token in secure storage (for example, Azure Key Vault).Authorization: Bearer {ejento_access_token} and the Ocp-Apim-Subscription-Key header.POST /auth-service/api/v2/users/refresh-access-token with Authorization: Bearer {access_token} and the API key.200, replace both stored tokens with the new access_token and ejento_access_token from data.ejento_access_token. Because you refresh ahead of expiry, requests never fail due to an expired token.access_token and ejento_access_token through a login endpoint (this guide uses Microsoft Azure AD SSO; see the Getting Started with Authentication guide for other methods).access_token; you receive a new access_token and ejento_access_token.