# POST /user/token

### More information related to Login with a custom token is available here:[ Custom Token Implementation](https://rezi-1.gitbook.io/rms-guide/rezi-rms-features/login-customization/custom-token-implementation).

## Get a User Token

<mark style="color:green;">`POST`</mark> `https://open-api.rezi.ai/v1/user/token`

This endpoint allows you to get a token to auto-connect your user by sharing user credential.

#### Headers

| Name                                             | Type   | Description                                                                                                                                                   |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Content-type<mark style="color:red;">\*</mark>   | string | "application/json"                                                                                                                                            |
| Authentication<mark style="color:red;">\*</mark> | string | <p>"Bearer PRIVATE\_TOKEN\_API\_KEY" <br>Authentication token to secure and track down your usage. Use this specific format with your Private API key<br></p> |

#### Request Body

| Name                                    | Type   | Description                                                                                             |
| --------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| uid<mark style="color:red;">\*</mark>   | string | <p>Password of the user your want to connect.<br>You can hash from your side before sending to API.</p> |
| email<mark style="color:red;">\*</mark> | string | Email of the user your want to connect.                                                                 |

{% tabs %}
{% tab title="200 User successfully retrieve." %}

```
{    
    "status": "success",
    "userID": "abcdefg",
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2lkZW50aXR5dG9vbGtpdC5nb29nbGVhcGlzLmNvbS9nb29nbGUuaWRlbnRpdHkuaWRlbnRpdHl0b29sa2l0LnYxLklkZW50aXR5VG9vbGtpdCIsImlhdCI6MTYyOTM2MTU5MywiZXhwIjoxNjI5MzY1MTkzLCJpc3MiOiJmaXJlYmFzZS1hZG1pbnNkay1wNmFyekByZXppLWRldmVsb3AuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJzdWIiOiJmaXJlYmFzZS1hZG1pbnNkay1wNmFyekByZXppLWRldmVsb3AuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJ1aWQiOiJ5ZGtzU1hEVTFQWjVoaHVOZENWbCJ9.TtMwURv2p_c2wm0MTVA1EmJQs_eXcg3KjINWs3SgGQHian2jp7zVSlN16fhf5IbyD9VWhujyG4738IjfjDnqW7EXrKRatm4QWGstCx6t1G2u86YObuJIaqzt09-IC_gVKLN4t4wJ5AHbACC1HjOf9t_Htd4ce8U7tdFqUtA_taR1BH6VQ0gISba8LICwXk6EC1vvwS3qPB202GCr4KAlyLnHLOmI6Xh93BghBtab2Do-_tpMVeu2NlCBlw0KCgsP2llpvqAALrqKyReyNb3ESPUGqsrNBS8Zi6gQnOuq-5VlVP08E9_YfswNPDRNHhKXYNn4IrRND62WWRchjys2AQ"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Server error" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Private token authentication error" %}

```javascript
{
    "status": "error",
    "errorCode": "token-01",
    "errorMessage": "unauthorized token"
}
```

{% endtab %}

{% tab title="400: Bad Request bad request, missing information" %}

```javascript
{
    "status": "bad request",
    "message": "missing information to connect user"
}
```

{% endtab %}

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

```javascript
{
    "code": 401,
    "message": "Jwt is expired"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
If first time for this user to connect, creation of user can up to 5 seconds.
{% endhint %}

{% hint style="danger" %}
UID associated to email should be all time the same. Password hashed as UID is a secure way to connect your user to our system. &#x20;
{% endhint %}
