> For the complete documentation index, see [llms.txt](https://premsie.gitbook.io/multi-board/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://premsie.gitbook.io/multi-board/back-end-authentification.md).

# \[Back-end] Authentification

## 회원가입

## userId에 대해 중복 여부를 확인합니다

<mark style="color:blue;">`GET`</mark> `http://localhost:8000/api/auth/check/{userId}`

#### Path Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| userId<mark style="color:red;">\*</mark> | String | 유저ID        |

{% tabs %}
{% tab title="200: OK 중복된 아이디가 존재하지 않는 경우 " %}

{% endtab %}

{% tab title="409: Conflict 중복된 아이디가 존재하는 경우  " %}

{% endtab %}
{% endtabs %}

## 회원가입을 요청합니다.

<mark style="color:green;">`POST`</mark> `http://localhost:8000/api/auth/signup`

#### Request Body

| Name                                              | Type   | Description |
| ------------------------------------------------- | ------ | ----------- |
| password<mark style="color:red;">\*</mark>        | String | 사용자 비밀번호    |
| confirmPassword<mark style="color:red;">\*</mark> | String | 사용자 비밀번호 확인 |
| name<mark style="color:red;">\*</mark>            | String | 사용자 이름      |
| id<mark style="color:red;">\*</mark>              | String | 사용자 아이디     |

{% tabs %}
{% tab title="201: Created 회원가입 완료" %}

{% endtab %}

{% tab title="400: Bad Request 클라이언트가 잘못된 요청을 한 경우" %}

{% endtab %}

{% tab title="409: Conflict 중복된 아이디가 존재할 경우 " %}

{% endtab %}
{% endtabs %}

## 로그인

## 로그인을 요청합니다.

<mark style="color:green;">`POST`</mark> `http://localhost:8000/api/auth/login`

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark>       | String | 사용자 아이디     |
| password<mark style="color:red;">\*</mark> | String | 사용자 비밀번호    |

{% tabs %}
{% tab title="200: OK 로그인 성공" %}

{% endtab %}

{% tab title="400: Bad Request 클라이언트가 잘못된 요청을 한 경우" %}

{% endtab %}

{% tab title="401: Unauthorized 로그인 실패 시" %}

{% endtab %}

{% tab title="404: Not Found 사용자 계정이 존재하지 않거나 찾을 수 없는 경우 " %}

{% endtab %}
{% endtabs %}

## JWT

## JWT 토큰 유효성을 확인합니다.

<mark style="color:blue;">`GET`</mark> `http://localhost:8000/api/auth/check`

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| jwt  | String | JWT 토큰      |

{% tabs %}
{% tab title="200: OK JWT 토큰이 유효한 경우 " %}

{% endtab %}

{% tab title="401: Unauthorized JWT 토큰이 유효하지 않는 경우 " %}

{% endtab %}
{% endtabs %}

## JWT 토큰 유효성과 사용자 권한에 따른 상태를 반환합니다.

<mark style="color:blue;">`GET`</mark> `http://localhost:8000/api/auth/status`

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| jwt  | String | JWT 토큰      |

{% tabs %}
{% tab title="200: OK JWT 토큰이 유효한 경우 " %}

{% endtab %}

{% tab title="401: Unauthorized JWT 토큰이 유효하지 않는 경우 " %}

{% endtab %}
{% endtabs %}

## 게시글의 작성자와 토큰 유저ID가 동일한지 확인합니다.

<mark style="color:blue;">`GET`</mark> `http://localhost:8000/api/permission`

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
| jwt  | String | JWT 토큰      |

{% tabs %}
{% tab title="200: OK JWT 토큰이 유효한 경우 " %}

{% endtab %}

{% tab title="401: Unauthorized JWT 토큰이 유효하지 않는 경우 " %}

{% endtab %}
{% endtabs %}
