-
Notifications
You must be signed in to change notification settings - Fork 0
인증 API
황종훈 edited this page Apr 13, 2021
·
1 revision
/auth
- 로그인 시도
- 서버에서 구글 API 메타 정보(client_id, client_secret, grant_type, redirect_uri, code)를 패러미터로 설정하여 엑세스 토큰, 아이디 토큰 발급
- 서버에서 토큰 정보 해독하여 DB 확인
4-1. 존재하는 유저의 경우 해주고 로그인
4-2. 존재하지 않는 유저의 경우 Response로 토큰 전달 해주며 회원가입 폼으로 - 회원가입 폼을 입력하고 작성하면 회원가입 완료 및 로그인
-
URL
/google/loginor/google/signin -
Method
GET -
Headers
| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| O |
- Success Body
{
"result": {
"type": "auth",
"status": 200,
"success": true,
"access_token": "...",
"message": "구글 소셜 로그인 성공"
},
"error": null
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| result.type | String | 데이터 타입 | "auth" | O |
| result.status | Integer | HTTP status code | 200 | O |
| result.success | Boolean | 요청 성공 여부 | false | O |
| result.message | String | 결과 메시지 | "닉네임을 입력해주세요" |
- Fail Body
{
"result": null,
"error": {
"type": "auth",
"status": 500,
"message": "서버 내부 에러"
}
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| error.type | String | 데이터 타입 | "auth" | O |
| error.status | Integer | HTTP status code | 500 | O |
| error.message | String | 결과 메시지 | "서버 내부 에러" |
-
URL
/registeror/signup -
Method
GET -
Headers
{
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| access_token | String | 액세스 토큰 | ... | O |
- Success Body
{
"result": {
"type": "auth",
"status": 200,
"success": true,
"access_token": "...",
"id_token": "...",
"message": ""
},
"error": null
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| result.type | String | 데이터 타입 | "auth" | O |
| result.status | Integer | HTTP status code | 200 | O |
| result.success | Boolean | 요청 성공 여부 | false | O |
| result.access_token | String | 액세스 토큰 | ... | O |
| result.id_token | String | 아이디 토큰(소셜 계정 정보 포함) | ... | O |
| result.message | String | 결과 메시지 | "" |
- Fail Body
{
"result": null,
"error": {
"type": "auth",
"status": 500,
"message": "서버 내부 에러"
}
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| error.type | String | 데이터 타입 | "auth" | O |
| error.status | Integer | HTTP status code | 500 | O |
| error.message | String | 결과 메시지 | "서버 내부 에러" |
-
URL
google/registeror/google/signup -
Method
POST -
Headers
{
"access_token": "...",
"id_token": "..."
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| access_token | String | 액세스 토큰 | ... | O |
| id_token | String | 아이디 토큰(소셜 계정 정보 포함) | ... | O |
- Body
{
"nickname": "죠르디",
"intro": "떠내려 온 빙하에서 깨어난 공룡",
"picture": "https://item.kakaocdn.net/do/437998cb670b87a9a8faca156155beeb8f324a0b9c48f77dbce3a43bd11ce785",
"job": "카카오 니니즈"
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| nickname | String | 유저 별명 | "죠르디" | O |
| intro | String | 유저 자기소개 | "떠내려 온 빙하에서 깨어난 공룡" | O |
| picture | String | 유저 이미지 URL | "..." | O |
| job | String | 유저 직업 | "카카오 니니즈" | O |
- Success Body
{
"result": {
"type": "auth",
"status": 200,
"success": true,
"access_token": "...",
"message": "구글 회원가입 성공"
},
"error": null
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| result.type | String | 데이터 타입 | "auth" | O |
| result.status | Integer | HTTP status code | 200 | O |
| result.success | Boolean | 요청 성공 여부 | false | O |
| result.access_token | String | 액세스 토큰 | ... | O |
| result.message | String | 결과 메시지 | "닉네임을 입력해주세요" |
- Fail Body
{
"result": null,
"error": {
"type": "auth",
"status": 500,
"message": "서버 내부 에러"
}
}| Field | Type | Description | Example | Required |
|---|---|---|---|---|
| error.type | String | 데이터 타입 | "auth" | O |
| error.status | Integer | HTTP status code | 500 | O |
| error.message | String | 결과 메시지 | "서버 내부 에러" |