Skip to content

[Feat-T3-66] 카카오 로그인 구현#13

Merged
choijungp merged 8 commits intodevelopfrom
feat/kakao-login
Jun 30, 2025
Merged

[Feat-T3-66] 카카오 로그인 구현#13
choijungp merged 8 commits intodevelopfrom
feat/kakao-login

Conversation

@choijungp
Copy link
Copy Markdown
Contributor

🌁 Background

소셜 로그인 중 카카오 로그인 기능을 구현하였습니다.
KakaoSDK 외부 의존성을 추가하여 카카오에서 토큰 값을 받아와 빛나길 서버로 보내주었습니다.

Apple 로그인과 같은 AuthEndpoint를 사용할 수 있도록 확장 가능한 구조로 구현했습니다.
로그아웃, 탈퇴 또한 같은 Endpoint, AuthRepository를 사용할 수 있도록 구현했습니다.

📱 Screenshot

Simulator.Screen.Recording.-.iPhone.15.-.2025-06-30.at.17.18.58.mp4
스크린샷 2025-06-30 17 19 20

👩‍💻 Contents

  • Kakao SDK 외부 의존성 추가
  • Kakao 네이티브 키 값 설정
  • LoginUseCase 구현 (kakaoLogin)
  • AuthRepository 구현 (kakaoLogin)
  • LoginViewController 및 LoginViewModel 구현

✅ Testing

SceneDelegate에서 첫 화면을 LoginViewController로 수정하여, 카카오 로그인을 테스트 해봤습니다.
또한 KeychainStorage에 토큰값이 저장된 것도 확인 완료했습니다.

📝 Review Note

로그인 화면 및 분기 처리

  • 디자인이 완료되지 않아 LoginView에 간단한 카카오 로그인 버튼만 생성했습니다. 디자인은 추후 붙이겠습니다.
  • 또한 로그인 성공 여부에 따라 화면을 전환하거나 에러 처리를 해야 합니다. 현재는 분기처리만 구현한 뒤 세부 로직은 TODO 주석을 남겨두었습니다.

서버 요청 값 수정 (Endpoint, URLRequest)

  • 서버에서 파라미터 값들을 Query 혹은 Body로 값을 보낼 지 수정될 가능성이 있습니다.
  • 이에 따라 기존 Network 모듈에서 구현되었던 Endpoint, URLRequest extension을 수정할 필요가 있었습니다.
  • 추후 서버 요청사항이 바뀌더라도 AuthEndpoint 값만 수정하면 가능하게 구현하였습니다.

Concurrency 사용

  • Kakao SDK에서 제공하는 로그인 함수들은 escaping 클로저 기반의 비동기 API이고, 기존 구현한 NetworkService 코드는 async/await로 구현되어 있었습니다.
  • 또한 KakaoSDK 내부에서 사용하는 함수들은 MainActor에서 실행되어야 했습니다.
  • 따라서 completion 기반의 API를 async/await로 래핑하여 자연스러운 흐름으로 통합하고자 Concurrency를 사용하였습니다.
  • 결과적으로, ViewModel에서 Task 처리를 진행하고 Publisher를 통해 ViewController에 값을 바인딩할 수 있도록 했습니다.
  • 로그인 결과는 Publisher가 저장하고 있을 필요가 없다고 생각하여 PassthroughSubject로 구현했습니다.

- Endpoint, URLRequest 수정
- 기존 parameter만 받던 Endpoint에서 queryParameters, bodyParameters를 구분지어서 받도록 수정
- 확장해서 만든 커스텀 URLRequest 생성자에서 url 뿐만 아니라 queryParamters도 받아 쿼리 파라미터가 있다면 붙여서 url 만들어주도록 수정
- 그에 따른 TestEndpoint 수정
- Enum, Error 폴더 구조 정리
- AuthEndpoint 구현
- AuthRepository 구현체 및 추상체 구현
- LoginUseCase 구현체 및 추상체 구현
@choijungp choijungp requested a review from generalban June 30, 2025 08:38
@choijungp choijungp self-assigned this Jun 30, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 30, 2025

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.


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 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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

var headers: [String : String] {
switch self {
case .login(_, _, let token):
return ["Authorization": token]
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.

API 명세에서 SocialAccessToken 헤더를 명시적으로 요구 하고 있어요
Authorization은 다른 인증에 사용되는 표준 헤더로 혼동될 수 있습니다

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.

PR description에도 기재했듯이 서버 수정 가능성이 있었습니다.
현재 PR은 서버 수정사항이 반영되기 전에 작성되어 있어서 서버통신, ViewModel, UseCase, Repository 위주로 확인 부탁드립니다.

서버 변경 사항은 Endpoint만 수정하면 됩니다. 스웨거 확인 후 수정하며 커밋하겠습니다.

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.

확인했습니다!
기타 구조적 부분은 훌륭하게 구현하셨습니다!

}
}

var queryParameters: [String : String] {
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.

스웨거의 Request body 섹션에 명시된 대로 JSON 형식으로 전송해야 하지 않나요?

- AuthEndpoint 수정
- accessToken, refreshToken 저장 후 로그 찍기
@choijungp
Copy link
Copy Markdown
Contributor Author

@generalban

서버 요청 사항 반영 후 수정했습니다. 확인 부탁드립니다.
현재 브랜치에서 테스트도 완료했습니다. (서버에서 받아온 access token, refresh token 저장)

@generalban
Copy link
Copy Markdown
Contributor

체크 했습니다!! 수고하셨습니다~

@choijungp choijungp merged commit 865a97a into develop Jun 30, 2025
2 checks passed
@choijungp choijungp deleted the feat/kakao-login branch July 1, 2025 00:00
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