> For the complete documentation index, see [llms.txt](https://docs.rocketfuel.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rocketfuel.inc/developer-guides/api-reference/payins/authentication/authenticate-a-merchant.md).

# Authenticate a merchant

This API allows the merchant to login into the RKFL system. After the successful login, API returns the "access token" and "refresh token". The access token would be used as a Bearer token for the subsequent API calls, while the refresh token will generate a new access token if the existing access token expires.

The concept of the refresh token usually works in a mobile application where users stay login for a long time. The use of the refresh token is subject to the policy of the integrated platform.

> The current expiry time of the access token is 30 min

{% hint style="info" %}
This API should be used for Server <-> Server communication only.
{% endhint %}

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

#### Request Body

| Name         | Type   | Description                                                                                                                                          |
| ------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| encryptedReq | String | Encrypted data containing email<mark style="color:red;">\*</mark>, password<mark style="color:red;">\*</mark>, deviceId, deviceToken, fcmToken, totp |

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

```javascript
{
    "ok": true,
    "result": {
        "access": ""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImZlNWNjODU0LWUxMzYtNDZiNy04OGRjLTRhMzNkZDdjMzFhMSIsImlhdCI6MTY1NDE2NDg3OCwiZXhwIjoxNjU0MTY2Njc4fQ.TqURCCKw8bjHv1hYKE6PAJgNdpvU-wD3zH3tPefhZP8"",
        "refresh": ""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImZlNWNjODU0LWUxMzYtNDZiNy04OGRjLTRhMzNkZDdjMzFhMSIsImlhdCI6MTY1NDE2NDg3OCwiZXhwIjoxNjU0MTY3Mjc4fQ.2MCHnI_ONxt9Yxg-po9lfe9I827IKPiANs2eO8neNsU"",
        "status": 1
    }
}
```

{% endtab %}

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

```javascript
{
  "ok": false,
  "statusCode": 401,
  "data": {
    
  },
  "message": "Incorrect email and password pair"
}
```

{% endtab %}

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

```javascript
{
  "ok": false,
  "statusCode": 500,
  "message": "Internal Server Error"
}
```

{% endtab %}
{% endtabs %}
