feat(app): 회원 가입 완료시 JWT 토큰을 쿠키로 저장하고 인증이 필요한 요청에 Bearer 헤더를 설정하도록 합니다. #140
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.
📌 이슈 링크
📖 작업 배경
🛠️ 구현 내용
RegisterService
에 에러 시의 로깅이 따로 없었어서 간단하게 추가했습니다.jwtUtils
라는 파일을 작성합니다.useRegister
훅에서 회원 가입이 완료될 때 얻을 수 있는 JWT 토큰을 쿠키에 저장하도록 합니다.authApi
라는 것을 만들어 두었었는데 이걸 통해 요청을 할 때 JWT 쿠키가 있는지 확인해 Bearer 헤더를 설정해 주도록 합니다.💡 참고사항
secure
와sameSite
정도의 설정만 할 수 있었습니다. CSR 기반일 때 현 상태에서 더 좋은 구현은 없을지 궁금하네요..!