codestates / codestates/Subllet

[ERR] Kakao OAuth - error_code: 'KOE320'

Open
#149 0 comments 0 reactions 2 assignees Claimed by @BassistHeo View on GitHub
ERR
Dominant language
JavaScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### 어떤 에러인가요?
- 동일한 인가 코드를 두 번 이상 사용하거나, 이미 만료된 인가 코드를 사용한 경우, 혹은 인가 코드를 찾을 수 없는 경우 발생하는 에러입니다.
![image](https://user-images.githubusercontent.com/80724255/145073054-b1dcea32-6d22-4650-bceb-d41346dd88bf.png)

### 에러 메시지
![image](https://user-images.githubusercontent.com/80724255/145072790-f642101e-7e71-4f7e-9a41-d0459cbc7ad3.png)

### 에러 핸들링 방법
- 클라이언트에서 요청이 두 번 연속으로 들어오는 것이 원인이었기 때문에 요청 보내는 axios에 useEffect를 적용했습니다.

```js
useEffect(() => {
axios
.post("/oauth/kakao", {
authorizationCode: authCode,
})
.then((response) => {
console.log(response);
const authUser = {
email: response.data.email,
nickname: "",
profile: response.data.profile,
signup_method: response.data.signup_method,
};
dispatch(setAuthUserInfo(authUser));
})
.catch((err) => {
console.error(err);
});
}, []);
```

### 에러 핸들링을 위해 참고한 레퍼런스 링크
팀장님이 도움을 주었습니다.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.