# Authentication

{% hint style="info" %}
Before authenticating , ensure you White list your IP before hand using the [Whitelist IP Guide](https://yogupay.gitbook.io/yogupay-payout-api/business-dashboard/whitelist-your-ips)
{% endhint %}

## Auth Login

<mark style="color:green;">`POST`</mark> `/auth/login`

The `POST` request is used to authenticate and login to YoguPay. Credentials are provided to business accounts by YoguPay

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Token        | token              |

{% hint style="info" %}
The token to be used above will be obtained from the response (expires after 30minutes requires a refresh)
{% endhint %}

**Body**

| Name       | Type   | Description           |
| ---------- | ------ | --------------------- |
| `username` | string | User name of the user |
| `password` | string | Password of the user  |

### Request and Response Example

{% tabs %}
{% tab title="Request" %}

```json
{
  "password": "1",
  "username": "user@yogupay.com"
}
```

{% endtab %}

{% tab title="Successful Response" %}

```json
{
    "status": "1",
    "message": "Login successful",
    "image": "https://tumapay.com/tp/images/avatar.png",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTAwOTAsInVzZXJuYW1lIjoiZXJyb2xAeW9ndXBheS5jb20iLCJlbnZpcm9ubWVudCI6InN0YWdpbmciLCJpcF9hZGRyZXNzIjoiOjpmZmZmOjQxLjkwLjExNi4xNjEiLCJpYXQiOjE3MzAxMDU2MTAsImV4cCI6MTczMDEwNzQxMH0.HP9SGLNJsXW7DgGK0AYq6CYJjTc1YXLQbRekxK-dsR8",
    "username": "user@yogupay.com",
    "is_verified": 1,
    "country_code": "GB",
    "phone_number": 254712345678,
    "full_name": "Demo Account",
    "number_of_transactions": 0
}
```

{% endtab %}

{% tab title="Failed Response" %}

```json

{
    "status": "0",
    "message": "Invalid Login Details"
}

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token obtained from the response above will be used to authenticate subsequent pages
{% endhint %}
