-
Notifications
You must be signed in to change notification settings - Fork 0
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
임시 로그인 #21
임시 로그인 #21
Conversation
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.
간단하게 몇 개 남겨봅니다!
src/app/(sidebar)/login/page.tsx
Outdated
|
||
try { | ||
const response = await postLogin({ loginId, password }); | ||
localStorage.setItem('accessToken', response.data.accessToken); |
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.
고생하셨습니다~! 코멘트 확인 부탁드려요!
+) 아 혹시 axios response interceptor를 통해 access token 만료 응답이 오면 해당 로그인 페이지로 자동으로 라우팅 시켜주는 로직도 추가해주실수 있나요?? 엑세스 토큰이 만료될때마다 재로그인하는 과정(일일이 url 입력해서 로그인 페이지로 넘어와서 하는 과정)이 조금 귀찮을 것 같아서요...ㅎ
src/app/(sidebar)/login/page.tsx
Outdated
useEffect(() => { | ||
const token = localStorage.getItem('accessToken'); | ||
if (token) { | ||
setIsLogin(true); | ||
} else { | ||
setIsLogin(false); | ||
} | ||
}, []); |
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.
단순 accessToken이 스토리지에 있다 === 로그인 상태다
가 아니지 않나요!?
해당 토큰의 만료 여부 확인 로직도 필요할 것 같습니다!
…to feat/tempLoogin
…to feat/tempLoogin
…to feat/tempLoogin
1. 무슨 이유로 코드를 변경했나요?
임시 로그인 기능을 구현해두었습니다. 소셜 로그인 로직이 아직 나오지 않아서 서버 측에서 전달 받은 id/pw 값을 입력하면 accessToken이 로컬스토리지에 저장 됩니다. (id/pw 값은 스웨거 예시 값으로 확인하시면 됩니다.)
2. 어떤 위험이나 장애를 발견했나요?
임시 구현이므로, 다른 기능과의 호환성 문제가 발생할 가능성이 있습니다.
로컬 스토리지에 토큰을 저장하는 방식이 향후 브라우저 보안 정책 변화에 영향을 받을 수 있습니다.
토큰 만료 기간을 확인하고 리프레쉬 토큰으로 새 토큰을 발급 받는 api가 아직 없어서 해당 부분은 아직 구현 안되어 있습니다.
추후 인터셉트 내에서 구현할 예정입니다.
3. 관련 스크린샷을 첨부해주세요.
https://github.com/user-attachments/assets/f6182611-1eee-43ba-9c91-af09101f045d
가라 뷰 입니다..
4. 완료 사항
임시 로그인 기능 구현
Axios 인스턴스에 토큰 추가 로직 적용
사용자 로그인 성공 시 토큰을 로컬 스토리지에 저장하는 기능 추가
수동 테스트를 통해 기본적인 로그인 흐름 검증 완료
5. 추가 사항 / 코드 리뷰 받고 싶은 부분
임시 로그인 구현이기 때문에 이후 소셜 로그인에서도 살릴 부분들 위주로 확인해주시면 좋을 것 같습니다
임시 로그인 구현에서 보완이 필요한 부분이 있는지 리뷰를 받고 싶습니다.
현재 로직이 이후 계획된 정식 로그인 구현에 어떻게 영향을 줄 수 있는지에 대한 의견을 듣고 싶습니다.