Skip to content

[Feat-T3-75] 로그아웃, 탈퇴 및 토큰 재발급 로직 구현#15

Merged
choijungp merged 8 commits into
developfrom
feat/logout
Jul 6, 2025
Merged

[Feat-T3-75] 로그아웃, 탈퇴 및 토큰 재발급 로직 구현#15
choijungp merged 8 commits into
developfrom
feat/logout

Conversation

@choijungp

Copy link
Copy Markdown
Contributor

🌁 Background

로그아웃, 탈퇴, 토큰 재발급 기능을 구현하였습니다.

📱 Screenshot

  • 카카오 소셜 로그인 성공 > 로그아웃 성공
    image

  • 카카오 소셜 로그인 성공 > 탈퇴 성공
    스크린샷 2025-07-06 14 45 37

  • 토큰 재발급 성공
    스크린샷 2025-07-06 14 49 01

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

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

👩‍💻 Contents

  • AuthEndpoint에 로그아웃, 탈퇴, 토큰 재발급 케이스 추가
  • AuthRepository에 logout, withdraw, reissueToken 함수 구현 (AuthRepositoryProtocol에도 함수 정의)
  • LogoutUseCase, WithdrawUseCase 구현 (LogoutUseCaseProtocol, WithdrawUseCaseProtocol 정의)
  • health-check 테스트 관련 코드 삭제

✅ Testing

현재 애플 로그인은 서버와 협의할 사항이 남아있어 (Review Note 참고),
스웨거를 참고하여 카카오 소셜 로그인을 진행한 계정을 기준으로 로그아웃, 탈퇴, 토큰 재발급을 테스트해보았습니다.

테스트 시나리오는 다음과 같습니다.

  • 로그인 > 로그아웃 (성공)
  • 로그인 > 탈퇴 (성공)
  • 로그인 > 로그아웃 > 탈퇴 (로그아웃 성공, 탈퇴 실패)
  • 로그인 > 탈퇴 > 로그아웃 (탈퇴 성공, 로그아웃 실패)

📝 Review Note

Apple 로그인 탈퇴
Apple 로그인의 경우, 최초 로그인 시에만 유저의 개인 정보를 가져옵니다.
서버와 테스트 진행하던 도중, 로그인한 사용자가 탈퇴하고 같은 계정으로 재로그인 시 최초 로그인으로 인식되지 않아 유저의 정보를 가져오지 못하는 이슈를 확인했습니다.

이는 서버와 더 논의 후 수정이 필요합니다.
따라서 테스트는 카카오 소셜 로그인을 위주로 진행하였습니다.


토큰 재발급 로직
원래 현재 PR의 task은 로그아웃, 탈퇴였지만 Auth 관련 로직 중 토큰 재발급도 진행되어야 할 것 같다고 판단되어 관련 로직을 구현했습니다.
다만 토큰 재발급의 경우 UseCase를 따로 두는 것이 아닌 서버에서 토큰 만료 응답을 받을 경우 reissue 요청을 해야 한다고 생각됩니다.
이는 어떤 방식으로 처리할 지 추후 논의가 더 필요합니다.

-> AuthRepository에 reissueToken() 함수를 두는 것은 맞다고 생각하지만, 이를 위한 UseCase를 생성하는 것은 아니라고 생각함.


테스트를 위한 로직과 버튼 (LoginViewModel, LoginViewController)
로그아웃 및 탈퇴는 설정 페이지에서 진행됩니다.
하지만 현재 설정 페이지가 만들어지지 않은 관계로 LoginViewController와 LoginViewModel에서 테스트를 위한 함수 및 버튼을 그려
로직이 성공적으로 수행되는지 확인했습니다.

추후 설정 View가 만들어질 경우 로직을 옮겨야 합니다. (LogoutUseCase, WithdrawUseCase 이동)

📣 Related Issue

  • close #T3-75

choijungp added 8 commits July 4, 2025 18:53
- 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 테스트 관련 버튼 및 함수 추가
@choijungp
choijungp requested a review from generalban July 6, 2025 06:11
@choijungp choijungp self-assigned this Jul 6, 2025
@coderabbitai

coderabbitai Bot commented Jul 6, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in a Comment
  • Commit Unit Tests in branch feat/logout

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @coderabbitai 요약 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@generalban generalban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 전체적으로 잘 구성되어 있고, 책임 분리와 에러 핸들링 깔끔합니다~


// TODO: 추후 reissue 어디로 가야 하나 ..
/// 토큰 재발급을 진행합니다.
func reissueToken() async throws

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로그아웃과 토큰 재발급은 완전히 다른 도메인 로직이라 생각해요 분리된 프로토콜 생성이 필요해보입니닷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 노트 확인부탁드려요 ~~

@choijungp
choijungp merged commit 54ef95e into develop Jul 6, 2025
2 checks passed
@choijungp
choijungp deleted the feat/logout branch July 6, 2025 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants