> For the complete documentation index, see [llms.txt](https://openup.gitbook.io/cape-agulhas-app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openup.gitbook.io/cape-agulhas-app/api/jwt-token.md).

# User authentication (JWT Token)

## Get token

<mark style="color:green;">`POST`</mark> `https://muni-portal-backend.openup.org.za/api/token/`

Get access and refresh token for the user

#### Request Body

| Name     | Type   | Description   |
| -------- | ------ | ------------- |
| password | string | User password |
| username | string | User name     |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    "access": "JWT.ACCESS.TOKEN",
    "refresh": "JWT.REFRESH.TOKEN"
}
```

{% endtab %}

{% tab title="404 User not found" %}

```
```

{% endtab %}
{% endtabs %}

## Refresh access token

<mark style="color:green;">`POST`</mark> `https://muni-portal-backend.openup.org.za/api/token/refresh/`

Get new access token by refresh token

#### Path Parameters

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| refresh | string | JWT refresh token |

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

```
{
    "access": "JWT.ACCESS.TOKEN",
    "refresh": "JWT.REFRESH.TOKEN"
}
```

{% endtab %}

{% tab title="400 " %}

```
```

{% endtab %}
{% endtabs %}
