# Authentication

## Realiza a criação de um token de acesso aos serviços

<mark style="color:green;">`POST`</mark> `https://{account}.myhubdelivery.io/license-manager/api/v1/oauth/token`

**Content-Type:** application/x-www-form-urlencoded

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| client\_id<mark style="color:red;">\*</mark>     | String | <\<AccountClientID>>     |
| client\_secret<mark style="color:red;">\*</mark> | String | <\<AccountClientSecret>> |
| grant\_type<mark style="color:red;">\*</mark>    | String | client\_credentials      |

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

```javascript
{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBY2NvdW50SWQiOiIyYllsNndnTTlaIiwiQWNjb3VudFNsdWciOiJodWJkZWxpdmVyeSIsIk1lcmNoYW50cyI6IltdIiwicm9sZSI6IkFwaVB1YmxpYyIsIkFwaVB1YmxpYyI6InRydWUiLCJTY29wZXMiOiJpby5hbGwiLCJuYmYiOjE2NTI5ODQ4MDEsImV4cCI6MTY1MzA3MTIwMSwiaWF0IjoxNjUyOTg0ODAxfQ.V717416_87wxYHlpFx587l0dNEwTjdlEmNpPzOua2nbFlN6H2RQ",
    "token_type": "Bearer",
    "expires_in": 86400
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "type": "https://tools.ietf.org/html/rfc7235#section-3.1",
    "title": "Unauthorized",
    "status": 401,
    "traceId": "00-cd0c0257a67e9a3fe57dc8c160e01607-b5994934dd13d84f-01"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Exemplo da requisição em formato CURL**
{% endhint %}

```
curl --location --request POST 'https://{account}.myhubdelivery.io/license-manager/api/v1/oauth/token' \CU
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=AccountClientID>>' \
--data-urlencode 'client_secret=AccountClientSecret>>' \
--data-urlencode 'grant_type=client_credentials'
```
