# Authentications

## Login o inicio de sesión de un merchant

<mark style="color:green;">`POST`</mark> `/api-hub/v1/auth/merchant/login`

El token tiene una duración de 1 hora.

#### Request Body

| Name                                          | Type   | Description                   |
| --------------------------------------------- | ------ | ----------------------------- |
| public\_key<mark style="color:red;">\*</mark> | String | El llave pública del merchant |
| secret\_key<mark style="color:red;">\*</mark> | String | El llave secreta del merchant |

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

```javascript
{
	"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViamVjdCI6InRlc3RAZ21haWwuY29tIiwiaWF0IjoxNTE2MjM5MDIyfQ.ecspcYS8Da_WEvyD-KdE11ydIkmDwhJocCokwy1h4ck"
}
```

{% endtab %}
{% endtabs %}

## Se confirma el token de acceso de un merchant

<mark style="color:orange;">`PUT`</mark> `/api-hub/v1/auth/merchants/access-tokens/confirm`

Sólo se ejecuta por única vez en el primer login para generar sus nuevas credenciales, a las cuales sólo usted podrá tener acceso.&#x20;

:warning: El Response devolverá sus nuevas credenciales y estas debe guardarlas para poder iniciar y generar sus token de acceso. &#x20;

#### Headers

| Name                                                  | Type   | Description                                                                                                                   |
| ----------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| authorization-token<mark style="color:red;">\*</mark> | String | <p>Se envía el token generado luego del Login, se debe enviar con el siguiente formato:</p><p>"Bearer JHgytHG67687JHG..."</p> |

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

```javascript
{
	"code": "00000",
	"message": "Successful",
	"data": {
		"id": "be4b0ed9-be13-4604-a8cc-4204f1468d75",
		"status": "ACTIVE",
		"created_at": "2022-11-19T22:37:07.601516+00:00",
		"updated_at": "2022-11-19T22:37:07.601516+00:00",
		"deleted_at": null,
		"is_deleted": false,
		"is_deleted_by": null,
		"merchant_id": "6a89bef8-6dbd-4963-b26f-bb928efaa4b2",
		"public_key": "9a5fa3fe-c284-44eb-ab1d-7b8572dde410",
		"secret_key": "ceeba05c-b1ab-43d3-8274-7e6538fcfc5f",
		"is_verify": true,
		"access_role": "gbc_core_role_api"
	}
}
```

{% endtab %}

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

```javascript
{
    "message": "Authorization is missing",
    "data": []
}
```

{% endtab %}
{% endtabs %}
