# Authentication

### **Authentication** <a href="#authentication" id="authentication"></a>

All API requests require authentication via OAuth 2.0 Bearer Token. The **client\_id** and **client\_secret** is unique to each customer and will be provided by the MadConnect technical team. Clients have to request a new token on expiry of the existing access token.

#### **Get Access Token** <a href="#get-access-token" id="get-access-token"></a>

```
POST /es/v2/oauth/client-token
```

**Request Body:**

```
{
  "clientId" : string,
  "clientSecret": string
}
```

**Response:**

```
{
   "accessToken": string,
   "tokenType": string,
   "expiry": 86400,  // in seconds
}
```

**Sample Curl:**

```
curl --location '<host>/es/v2/oauth/client-token' \
--header 'Content-Type: application/json' \
--data '{
  "clientId" : "sv1bF0b1dJ1e4chd",
  "clientSecret": "B3dbXd61f122Of3db9dP0Hd6d547da02"
}'
```

#### **Authentication Headers** <a href="#authentication-headers" id="authentication-headers"></a>

The access token should be passed in Authorization header as bearer token in each request to the MadConnect Embedded API.

```
Authorization: Bearer YOUR_ACCESS_TOKEN
```

####


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.madconnect.ai/deployment-options/madconnect-apis/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
