-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Refactor] 401시 리프레시 토큰을 통한 재발급 인터셉터/미들웨어 수정 #466
base: develop
Are you sure you want to change the base?
Conversation
|
||
return axiosInstance(originRequest); | ||
} catch (error) { | ||
console.log(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
내가 콘솔 발견 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
한 가지 궁금한 점은 미들웨어는 어느 시점에 동작하는 것인가요??
미들웨어는 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 !!!!
withCredentials: true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 왜 없애준 거에요 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
드디어 리프레시 토큰?! 기대됩니다 역시 리드님 👍
해당 이슈 번호
closed #465
체크리스트
💎 PR Point
인터셉터/미들웨어 로직 수정해주었습니다.
일단
refreshToken
을 로컬스토리지로 받게 되면서, 이에 대한 저장과 인터셉터/미들웨어에서의 재발급 + 이후 추가 요청 로직을 구현하였습니다.미들웨어에서는
onResponse
콜백을 통해서 응답 상태코드가 401일때 reissue 요청을 보내도록 하고, 그게 아니라면 기존의 응답으로 반환하도록 하였습니다.msw
핸들러를 추가해서401
반환 시 리이슈 API 성공, 그리고 accesstoken 변경되는 것을 확인하였고return fetch
를 통해 기존의 요청을 한 번 더 전송하도록 하여 재요청되는 것을 확인하였습니다.