[Feat-T3-75] 로그아웃, 탈퇴 및 토큰 재발급 로직 구현#15
Conversation
- AuthRepositoryProtocol, AuthRepository에 logout 함수 정의 및 구현 - AuthError에 토큰 삭제 에러 추가
- LogoutUseCase Protocol, LogoutUsecase logout 함수 정의 및 구현 - LoginUseCase 폴더 이동
- 테스트 진행을 위해 LoginViewModel, LoginViewController에 로그아웃 버튼 추가 및 함수 구현
- AuthEndpoint에 withdraw case 추가 - AuthRepositoryProtocol 및 AuthRepository에 withdraw 함수 정의 및 구현 - WithdrawUseCaseProtocol 및 WithdrawUseCase 정의 및 구현 - Domain, Presentation 의존성 등록 및 조립 - LoginViewModel, LoginViewController에 테스트를 위한 함수 및 버튼 추가
- AuthEndpoint에 reissue 케이스 추가 - AuthRepositoryProtocol 및 AuthRepository에 reissueToken 정의 및 구현 - LoginViewModel, LoginViewController에 reissue 테스트 관련 버튼 및 함수 추가
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
generalban
left a comment
There was a problem hiding this comment.
코드 전체적으로 잘 구성되어 있고, 책임 분리와 에러 핸들링 깔끔합니다~
|
|
||
| // TODO: 추후 reissue 어디로 가야 하나 .. | ||
| /// 토큰 재발급을 진행합니다. | ||
| func reissueToken() async throws |
There was a problem hiding this comment.
로그아웃과 토큰 재발급은 완전히 다른 도메인 로직이라 생각해요 분리된 프로토콜 생성이 필요해보입니닷
🌁 Background
로그아웃, 탈퇴, 토큰 재발급 기능을 구현하였습니다.
📱 Screenshot
카카오 소셜 로그인 성공 > 로그아웃 성공

카카오 소셜 로그인 성공 > 탈퇴 성공

토큰 재발급 성공

카카오 소셜 로그인 성공 > 로그아웃 성공 > 탈퇴 실패

카카오 소셜 로그인 성공 > 탈퇴 성공 > 로그아웃 실패

👩💻 Contents
✅ Testing
현재 애플 로그인은 서버와 협의할 사항이 남아있어 (Review Note 참고),
스웨거를 참고하여 카카오 소셜 로그인을 진행한 계정을 기준으로 로그아웃, 탈퇴, 토큰 재발급을 테스트해보았습니다.
테스트 시나리오는 다음과 같습니다.
📝 Review Note
Apple 로그인 탈퇴
Apple 로그인의 경우, 최초 로그인 시에만 유저의 개인 정보를 가져옵니다.
서버와 테스트 진행하던 도중, 로그인한 사용자가 탈퇴하고 같은 계정으로 재로그인 시 최초 로그인으로 인식되지 않아 유저의 정보를 가져오지 못하는 이슈를 확인했습니다.
이는 서버와 더 논의 후 수정이 필요합니다.
따라서 테스트는 카카오 소셜 로그인을 위주로 진행하였습니다.
토큰 재발급 로직
원래 현재 PR의 task은 로그아웃, 탈퇴였지만 Auth 관련 로직 중 토큰 재발급도 진행되어야 할 것 같다고 판단되어 관련 로직을 구현했습니다.
다만 토큰 재발급의 경우 UseCase를 따로 두는 것이 아닌 서버에서 토큰 만료 응답을 받을 경우 reissue 요청을 해야 한다고 생각됩니다.
이는 어떤 방식으로 처리할 지 추후 논의가 더 필요합니다.
-> AuthRepository에
reissueToken()함수를 두는 것은 맞다고 생각하지만, 이를 위한 UseCase를 생성하는 것은 아니라고 생각함.테스트를 위한 로직과 버튼 (LoginViewModel, LoginViewController)
로그아웃 및 탈퇴는 설정 페이지에서 진행됩니다.
하지만 현재 설정 페이지가 만들어지지 않은 관계로 LoginViewController와 LoginViewModel에서 테스트를 위한 함수 및 버튼을 그려
로직이 성공적으로 수행되는지 확인했습니다.
추후 설정 View가 만들어질 경우 로직을 옮겨야 합니다. (LogoutUseCase, WithdrawUseCase 이동)
📣 Related Issue