> For the complete documentation index, see [llms.txt](https://ssus-organization.gitbook.io/elephant/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ssus-organization.gitbook.io/elephant/auth.md).

# auth

1. 로그인

## 로그인 기능

<mark style="color:green;">`POST`</mark> `https://www.elephantcodingclub.site/api/auth/login`

#### Request Body

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

{% tabs %}
{% tab title="200: OK 로그인 성공" %}
쿠키 내에 엑세스 토큰과 리프레시 토큰 저장하여 전달.
{% endtab %}

{% tab title="400: Bad Request 로그인 실패" %}

{% endtab %}
{% endtabs %}

2. 회원가입

## 회원가입 기능

<mark style="color:green;">`POST`</mark> `https://www.elephantcodingclub.site/api/auth/signup`

#### Request Body

| Name                                           | Type    | Description                    |
| ---------------------------------------------- | ------- | ------------------------------ |
| username<mark style="color:red;">\*</mark>     | String  | <p>사용자 아이디</p><p>(email형식)</p> |
| introduction<mark style="color:red;">\*</mark> | String  | 사용자 자기소개                       |
| nickname<mark style="color:red;">\*</mark>     | String  | 사용자 닉네임                        |
| password<mark style="color:red;">\*</mark>     | String  | 사용자 비밀번호                       |
| admin<mark style="color:red;">\*</mark>        | Boolean | 관리자 여부                         |
| adminToken                                     | String  | 관리자 토큰값                        |

{% tabs %}
{% tab title="200: OK 회원가입 성공" %}

{% endtab %}

{% tab title="400: Bad Request 회원가입 실패" %}

{% endtab %}
{% endtabs %}

3. 카카오 로그인

## 카카오 로그인

<mark style="color:blue;">`GET`</mark> `https://www.elephantcodingclub.site/api/auth/kakao/callback`

#### Headers

| Name                                                  | Type   | Description |
| ----------------------------------------------------- | ------ | ----------- |
| HttpServletResponse<mark style="color:red;">\*</mark> | Object | 응답 Servlet  |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| code<mark style="color:red;">\*</mark> | String | 카카오 인증 코드   |

{% tabs %}
{% tab title="201: Created 로그인 성공" %}

{% endtab %}

{% tab title="400: Bad Request 로그인 실패" %}

{% endtab %}
{% endtabs %}

4. 네이버 로그인

## 네이버 로그인

<mark style="color:blue;">`GET`</mark> `https://www.elephantcodingclub.site/api/auth/naver/callback`

#### Headers

| Name                                                  | Type   | Description |
| ----------------------------------------------------- | ------ | ----------- |
| HttpServletResponse<mark style="color:red;">\*</mark> | Object | 응답 Servlet  |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| code<mark style="color:red;">\*</mark> | String | 네이버 인증 코드   |

{% tabs %}
{% tab title="201: Created 로그인 성공" %}

{% endtab %}

{% tab title="400: Bad Request 로그인 실패" %}

{% endtab %}
{% endtabs %}

5. 구글  로그인

## 구글  로그인

<mark style="color:blue;">`GET`</mark> `https://www.elephantcodingclub.site/api/auth/google/callback`

#### Headers

| Name                                                  | Type   | Description |
| ----------------------------------------------------- | ------ | ----------- |
| HttpServletResponse<mark style="color:red;">\*</mark> | Object | 응답 Servlet  |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| code<mark style="color:red;">\*</mark> | String | 구글 인증 코드    |

{% tabs %}
{% tab title="201: Created 로그인 성공" %}

{% endtab %}

{% tab title="400: Bad Request 로그인 실패" %}

{% endtab %}
{% endtabs %}

6. 엑세스 토큰 갱신

## 엑세스 토큰 갱신

<mark style="color:blue;">`GET`</mark> `https://www.elephantcodingclub.site/api/auth/refresh/access-token`

엑세스 토큰 갱신

#### Headers

| Name                                                  | Type   | Description |
| ----------------------------------------------------- | ------ | ----------- |
| HttpServletRequest<mark style="color:red;">\*</mark>  | Object | 요청 Servlet  |
| HttpServletResponse<mark style="color:red;">\*</mark> | Object | 응답 Servlet  |

#### Cookies

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | JWT 엑세스 토큰값  |
| RefreshToken<mark style="color:red;">\*</mark>  | String | JWT 리프레시 토큰값 |

{% tabs %}
{% tab title="200: OK Access Token 생성 성공" %}

{% endtab %}

{% tab title="400: Bad Request Access Token 생성 실패" %}

{% endtab %}
{% endtabs %}

7. 로그아웃

## 로그아웃

<mark style="color:red;">`DELETE`</mark> `https://www.elephantcodingclub.site/auth/logout`

사용자 로그아웃 확인

#### Headers

| Name                                                  | Type   | Description |
| ----------------------------------------------------- | ------ | ----------- |
| HttpServletRequest<mark style="color:red;">\*</mark>  | Object | 요청 Servlet  |
| HttpServletResponse<mark style="color:red;">\*</mark> | Object | 응답 Servlet  |

#### Cookies

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| AccessToken<mark style="color:red;">\*</mark>  | String | JWT 토큰값     |
| RefreshToken<mark style="color:red;">\*</mark> | String | JWT 토큰값     |

{% tabs %}
{% tab title="200: OK Logout 성공" %}

{% endtab %}

{% tab title="400: Bad Request Logout 실패" %}

{% endtab %}
{% endtabs %}
