# Authenticate with JWT

## Authenticate a user with JWT

<mark style="color:green;">`POST`</mark> `/api.moojo.id/user/authenticate`

If the user is already authenticated in your agent or application, you can use their JWT to authenticate them with **moojoᴵᴰ** as well. This ensures that the user is seamlessly connected to their universal identity, along with any previously collected data.

**Headers**

| Name         | Value                               |
| ------------ | ----------------------------------- |
| Content-Type | `application/json`                  |
| x-api-key    | `Your API KEY as provided by Moojo` |

**Body**

| Name     | Type   | Description                                                                                                                            |
| -------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `idType` | string | <p>Specifies the type of identity being used. Currently, only Firebase JWT is supported.<br><br>use "<strong>firebaseJwt</strong>"</p> |
| `id`     | String | The encoded JWT                                                                                                                        |

**Request example**

{% tabs %}
{% tab title="body" %}
{% code overflow="wrap" %}

```json
{
    "idType": "firebaseJwt",
    "id": "nLzQbMXL9KgE4w-1Qlp9pdhlAZYWzBOgoaWntLoa9ThidkRQVIeByYmPhlXax9SjiOKv0_RVs0uhovGC_CuObMsFKO9uMuxula7cQ8FL5PVEZr7PrrQE1KrgoHCla8skSSTIn4Q_u3eBemRRRM156pROuIDkKaRz4GKHTDzI_Mi3Hh-OWuYIWpM_2GOrlKRHiP0njRakqh2IPjmB1PtKNX-4pc1-aLtIRvB5vXHG841-AUl5OVIEbkN1Agecwi-3LxXY9SzPWAadDzdEqd-lHDNcPItAdRlpijHOhFgQqwoXPgQONWpoFvRWQQ5F5ISMYr-rBrOZMhbBgXLmE3QeKg"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response example**

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

```json
{
    "status": "success",
    "traceId": "ce194afc-fe80-4cf9-a174-3e3256760ec8",
    "data": {
        "token":"6c0350a00925b9bbd3408a4e382c2790aa92accff189e7735fdf2a3d4dc67b08",
        "expiresAtIso8601":"2025-02-16T15:12:52.555Z",
        "publicUserId":"a6e8f837-2f6b-478c-a007-82989d000000",
        "publicKey":"0x0288f8935f7669832d4f5ae90c43d550e80f93420da7178019f89e0b00dfb0a000"
    }
}
```

{% endtab %}
{% endtabs %}

Upon successful authentication, a **valid token** is issued with a **2-hour expiration** period. \
This token can be used for any user-related API calls.
