Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 토큰 검증 실패 시 토큰 제거 #124

Closed
wants to merge 1 commit into from

Conversation

hwookim
Copy link
Collaborator

@hwookim hwookim commented Feb 13, 2023

close #103

💡 개요

  • 유효하지 않은 토큰으로 요청 시 토큰 제거

📝 작업 내용

  • 모든 페이지에서 사용되는 Header 컴포넌트에서 해당 역할을 수행
  • react-query의 options를 외부에서 주입할 수 있게 변경하고 onError를 통해 recoilValue를 reset하도록 변경

‼️ 주의 사항

  • 어째선지 2~3번 요청이 있은 뒤에 onError 발생합니다. 😢

🔗 참고자료

@hwookim hwookim added the ✨ feature 기능 개발 label Feb 13, 2023
@hwookim hwookim self-assigned this Feb 13, 2023
Copy link
Collaborator

@KIMSEUNGGYU KIMSEUNGGYU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음.. 리뷰 남겼는데 한 번 참고 부탁드립니다!

아직 fix 되지 않고 논의가 필요한 내용이라서 우선 해당 부분은 Comment 하겠습니다.
아니면 그냥 Approve 할까요??
의견주시면 따를게요~ ㅋㅋㅋㅋ

Comment on lines +18 to +27
const { data: member } = useMember(userSession?.accessToken, {
onError: (err) => {
const error = err as AxiosError<ErrorResponse>;
const code = error.response?.data.code;
if (Number(code) !== 2003) return;

resetUser();
},
});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#123 과 연관되어 있지만 해당 부분 구현하셔서 제가 생각했던 방법을 이야기하자면!

axios Response interceptor 에서 401 에러가 나면 refresh 토큰 발급하고 refresh 마저 에러가 나면 로그인이 안되는 방식으로 가면 어떨지 생각이 들었습니다!

어떻게 생각하시나요??

@hwookim hwookim marked this pull request as draft February 14, 2023 14:20
@hwookim hwookim closed this in #168 Feb 25, 2023
@hwookim hwookim deleted the feat/103-token branch February 25, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 유효하지 않은 토큰 소유 시 제거 로직 추가
2 participants