Feat#41 JWT RefreshToken 추가 및 코드 정리 #52
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JWT RefreshToken 추가 및 코드 정리
구현 내용
(기존: access_token에 플랫폼 별 유저 id 저장 -> 변경: id에 플랫폼 별 유저id 저장. access_token에 유저 refresh token 저장
To Reviewrs
기존에는 로그인시에 이미 존재하는 회원인지만 확인하고 토큰을 발급하는 로직이었습니다. 변경된 로직은 아래와 같습니다!
관련해서 재로그인 필요, access재발급, refresh재발급 상황에 나뉘어 DTO를 return하는 tokenChecktoken(req, res)함수와
단순히 토큰만 확인 후 정상이면 data를 리턴 하는 tokenVerify(token) 함수를 만들어 둔 상태입니다.
*Controller에서
tokenCheck(req.headers['access'])또는tokenVerify(req)를 사용해서 리턴 값을 가지고 에러 처리와 userId를 이용하여 service로 넘기면 좋을 것 같습니다.다만 만들면서 생각이 든 게 프론트 분들이랑 토큰을 어떻게 넘겨서 인증할 지 얘기가 충분하지 않았던 것 같아서 당장은 사용하기 어려울 수도 있겠다 싶어서 얘기를 나누면 좋을 것 같습니다!
Check List