# Authentication

DT's API endpoints are secured, and must be used with an authentication token.

The first step is to obtain an authorization header for authentication. This enables you to use the Management API and be verified as a user within the Console.

Generating your verification keys:

1. Click your login user name in the top-left corner.

<div align="left" data-with-frame="true"><figure><img src="https://1641760969-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8KSLu5HNiyDWpvGRZh7B%2Fuploads%2FcDHXXYRMOlpaS5DqbHMR%2Fimage.png?alt=media&#x26;token=37fa1989-0b6b-4b87-b13c-377c21063c87" alt="" width="209"><figcaption></figcaption></figure></div>

2. Click **User Profile** to open the User Profile Window.

<div align="left" data-with-frame="true"><figure><img src="https://1641760969-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8KSLu5HNiyDWpvGRZh7B%2Fuploads%2FBCslwZOeplQc5zcCxOvg%2Fimage.png?alt=media&#x26;token=8f3dce85-3c91-4dab-9b29-f2e757f615c3" alt=""><figcaption></figcaption></figure></div>

3. In the `Management API - Credentials` section, the **Client ID** and **Client Secret** Keys are displayed.

## Generate New Keys

You should generate new verification keys on a regular basis. In order to generate new keys, you must first revoke the current keys.

**To generate new verification keys:**

1. Log in to the [DT Console](https://console.fyber.com/), and click your user name in the left-hand menu.
2. Click **User Profile**.
3. For the verification keys you want to re-generate, click **Revoke**.

<div align="left" data-with-frame="true"><img src="https://1641760969-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8KSLu5HNiyDWpvGRZh7B%2Fuploads%2Fz7mx1T9DZCr3Dz3XdzSJ%2F6516446715037?alt=media&#x26;token=cac12545-c927-4475-b142-a9a8aaa12395" alt=""></div>

4. Click **Generate New Keys**. The keys you have generated must now be placed in the Endpoint to generate your Access Token to the Management API.

### Generating Your Access Token

Copy both the Client ID and Client Secret keys and create an HTTP request with the following body.

**Description**

Use the UI Management API credentials to authenticate your user and get back an access token to authorize further requests.

**Method**

`POST https://console.fyber.com/api/v2/management/auth`

### Request Parameters

| Key            | Description                                                                                                      | Type   | Required | Example                                      |
| -------------- | ---------------------------------------------------------------------------------------------------------------- | ------ | -------- | -------------------------------------------- |
| grant\_type    | <p>This key is constant and should always be completed for this API as "management\_client<br>\_credentials"</p> | String | Required | <p>"management\_client\_<br>credentials"</p> |
| client\_id     | The Client ID token from the UI received for authentication.                                                     | String | Required | <p>“677eXXXXXXcdcc3fd790<br>deb46duyud4”</p> |
| client\_secret | The Client Secret token from the UI received for authentication.                                                 | String | Required | “ghhjhiGHXXXXXX87686"                        |

### Example Request

```json
 {
   "grant_type": "management_client_credentials",
   "client_id": "677e6543049XXXXXXXXX0deb46d2ecd4",
   "client_secret": "d0iSLq5y6XXXXXuOyM4blm8GwzQb2sLOlcBtsI9KvBx9tGuucM2kvrdxXXXXXPjIunXbATQTkHDjHvVEVv1JgXFj0EUWmuNpNH53p9SnGWxwXXXXgdJSkCUDuHaDeFWHz-prMEGftXXXXXXfa_-8mRZURDZu2d_CRnwZ-Z51EnuFszgEP04f1AjcKTVhNSw0rXXXXXXdKaGZNM4EPsV5SxLBZKKdQxa3PPWL1Cb56U9ftviXPJKU47nAzXXXXXXXdfXKBsMCG2FX3nB7E2Eib_yHNK0EtXX4zFTr8uYRXXXXXXXCLMVRUxNjQ" 
 }
```

### Response Parameters

| Key         | Description                                                                | Type   | Required | Example                                                                                                                                                                              |
| ----------- | -------------------------------------------------------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| accessToken | Token to be used to authorize future requests                              | String | Required | <p>“eyJhbGciXXXXXXXXsInR5cCI6IkpXVC<br>J9.eyJpYXQiOjE2Mjg2NzI4OTMsImV4c<br>CI6MTYyODXXXXXXwiYXVkIjoibWFu<br>YWdlbWVudEFXXXXN1YiI6IjM2MiJ9.<br>cjx3AgYcI0XXXXYkVsO6F\_7M72lu\_p ”</p> |
| tokenType   | Only bearer token type is available                                        | String | Required | “bearer”                                                                                                                                                                             |
| expiresIn   | The number of seconds for which the token is valid (3600 seconds = 1 hour) | String | Required | 3600                                                                                                                                                                                 |

### Example Response

```json
{
  "accessToken": "eyJhbGciXXXXXiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2Mjg2NzI4OTMsIXXXXXXXODY3NjQ5MywiYXfdheibWFuYWdlbWVuXXXXXXXnN1YiI6IjM2MiJ9.cjx3AgYcI0w5qG0YkVsO6F_7M72lu_pqSqtXXXXXU",
  "tokenType": "bearer",
  "expiresIn": 3600
}
```

##
