# Authentication Process

## **Authentication Process**

### **Login**

<mark style="color:green;">`POST`</mark> `/api/v1/accounts/login`

#### Request Body

| Name                                       | Type   | Description      |
| ------------------------------------------ | ------ | ---------------- |
| username<mark style="color:red;">\*</mark> | String | StandardRegistry |
| password<mark style="color:red;">\*</mark> | String | test             |

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

```javascript
"username": "StandardRegistry",
    "did": "did:hedera:testnet:5jDN1zBJPjjQhRDZ4MV3q5CFUVM99WvfJ3zMLLhLS2yk_0.0.7495695",
    "role": "STANDARD_REGISTRY",
    "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.....",
    "weakPassword": false
```

{% endtab %}
{% endtabs %}

### Access Token

<mark style="color:green;">`POST`</mark> `/api/v1/accounts/access-token`

#### Request Body

| Name                                           | Type   | Description                                 |
| ---------------------------------------------- | ------ | ------------------------------------------- |
| refreshToken<mark style="color:red;">\*</mark> | String | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9....... |

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

```
{
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9......
}
```

{% endtab %}
{% endtabs %}

### Account Session

<mark style="color:blue;">`GET`</mark> `/api/v1/accounts/session`

#### Headers

| Name                 | Type   | Description                                |
| -------------------- | ------ | ------------------------------------------ |
| Authorization Bearer | String | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...... |

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

```
 "_id": "659e8127db770133c0d8fb26",
    "createDate": "2024-01-10T11:36:07.320Z",
    "updateDate": "2024-01-23T13:53:36.347Z",
    "username": "StandardRegistry",
    "password": "9f86d081884c7d659.....",
    "did": "did:hedera:testnet:5jDN1zBJPjjQhRDZ4MV3q5CFUVM99.....",
    "walletToken": "",
    "hederaAccountId": "0.0.749...",
    "role": "STANDARD_REGISTRY",
    "refreshToken": "a0dbe6f.....",
    "id": "659e8127db770133c..."
```

{% endtab %}
{% endtabs %}
