# Login

### Login the user <a href="#login-in-user" id="login-in-user"></a>

## Logs user in and returns JWT

<mark style="color:green;">`POST`</mark> `https://example.com/wp-json/rimplenet/v1 /users/login`

#### Request Body

| Name                                                | Type   | Description      |
| --------------------------------------------------- | ------ | ---------------- |
| user\_email<mark style="color:red;">\*</mark>       | String | Enter user email |
| user\_password <mark style="color:red;">\*</mark>   |        | Enter password   |
| token\_expiration<mark style="color:red;">\*</mark> | String | persistent       |

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

```
{
    "status_code": 200,
    "status": true,
    "message": "Login successful",
    "data": {
        "access_token": "Token_number",
        "user_id": "3",
        "user_email": "johndoe@gmail.com",
        "username": "john",
        "time_of_login": 1657454286
    },
    "error": []
}
```

{% endtab %}

{% tab title="400: Bad Request Validation error" %}

```
{
    "status_code": 400,
    "status": "failed",
    "message": "Validation error",
    "data": [],
    "error": [
        "Invalid Credential"
    ]

}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
To view request params, click on the arrow (>) at the right-hand side of the endpoint url to expand or collapse
{% endhint %}

**Sample response**

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

```
{
    "status_code": 200,
    "status": true,
    "message": "Login successful",
    "data": {
        "access_token": "Token_number",
        "user_id": "3",
        "user_email": "johndoe@gmail.com",
        "username": "john",
        "time_of_login": 1657454286
    },
    "error": []
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```
{
    "status_code": 400,
    "status": "failed",
    "message": "Validation error",
    "data": [],
    "error": [
        "Invalid Credential"
    ]
}
```

{% endtab %}
{% endtabs %}
