# Auth

We do not use JWT as in the Client section to identify the administrator. We use the `username`, `password` and `API key` that we specify in the `.env` file. After the client logs in, each request will have an `API-KEY` added to the headers object.

```
ADMIN_USERNAME=Enclaive
ADMIN_PASSWORD=Qw23K#D(#ke3
API_KEY=Mn3dcrNYNXswd332GSFVeq
APP_ADMIN_URL=
```

It is important to note that in the APP\_ADMIN\_URL field you must enter the URL where the admin dashboard is located. If the request comes from a different URL, the response will be an error with status `404 Not Found`.

## Login

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/admin/api/auth/login`

Admin authentication via email and password fields.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | App ID      |

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| username<mark style="color:red;">\*</mark> | String |             |
| password<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK " %}

```json
{"apiKey":"MWGCcrWxNXsvdxExcHYGGSFVRsnq"}
```

{% endtab %}
{% endtabs %}

## Get profile

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/admin/api/auth/profile`

Get an administrator profile.

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
{"username":"Enclaive","role":"Admin"}
```

{% endtab %}
{% endtabs %}
