Skip to main content
Version: DAI 7.5

Authentication Method

New Feature

Eggplant DAI API uses open standards authorization (OAuth 2.0 - Client Credentials Grant) to protect its APIs.

You must have a valid access token to use the Eggplant DAI Execution API. To obtain an access token, you need to:

  • Retrieve the OAuth credentials for your integration
  • Send an authentication request with your OAuth credentials to the token endpoint, shown below, that is generated for you.

Because the token expires after five minutes, to maintain access, you must regularly resend your credentials to get a new access token.

For step-by-step instructions on how to do this, see Getting Started.

Authentication Method

POST -> http://localhost:8000/auth/realms/{realm}/protocol/openid-connect/token

Headers

NameValue
Content-Typeapplication/x-www-form-urlencoded

Body Parameters

NameTypeDescriptionRequired
grant_typestringType: client_credentials
Uses your OAuth credentials to generate an access token.
Yes
client_idstringYour client_idYes
client_secretstringYour client_secretYes

Possible Responses

StatusStatus TextDescription
200OKSuccessful response.
400Bad requestRequired parameters were not sent
401Bad requestInvalid credentials were provided.
403ForbiddenNot enough available concurrent user licenses

Response Body JSON

The first example below shows a typical successful response (Status 200).

Example:

{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia...",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": "email template:dai:agents profile"
}
NameTypeDescriptionValue
access_tokenstringAccess token for a user account that has successfully authenticated.<dynamic>
expires_inintegerNumber of seconds that the access token is valid for.300 (or 5 minutes)
refresh_expires_inintegerNumber of seconds that the refresh token is valid for.1800 (or 30 minutes)
token_typestringType of access token used with OAuth 2.0.bearer
not-before-policybooleanPolicy is disabled.0
scopestringGrants the permissions of the System Administrator to the resource or application that uses the access tokenemail template:dai:agents profile

The next example shows Invalid Response Status 401 Unauthorized.

Example:

{
"message": "Not Authorized",
"description": "The credentials you provided are not valid."
}