Skip to content

Conversation

@stopstone
Copy link
Contributor

작업 내용

  • 카카오톡 앱으로 로그인을 시도하다가 실패하거나 사용자가 취소할 경우,
    별도의 에러 메시지 없이 바로 카카오계정(웹) 로그인으로 전환되도록 로직을 개선했습니다.
  • 사용자가 로그인을 취소했을 때 발생하는 ClientErrorKakaoUserCancelledException으로 매핑하여 처리합니다.

확인 방법

KakaoLoginManager에서 확인하실 수 있습니다.
카카오톡을 설치후 로그인하지 않고 소셜로그인을 수행하면 wb으로 redirect됩니다.

관련 이슈

- 카카오톡 앱으로 로그인을 시도하다가 실패하거나 사용자가 취소할 경우, 별도의 에러 메시지 없이 바로 카카오계정(웹) 로그인으로 전환되도록 로직을 개선했습니다.
- 사용자가 로그인을 취소했을 때 발생하는 `ClientError`를 `KakaoUserCancelledException`으로 매핑하여 처리합니다.
@gemini-code-assist
Copy link

Summary of Changes

Hello @stopstone, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 카카오 소셜 로그인 과정에서 사용자 경험을 개선하는 것을 목표로 합니다. 기존에는 사용자가 카카오톡 앱에 로그인되어 있지 않거나 로그인 시도를 취소할 경우, 명확한 다음 단계 없이 오류가 발생할 수 있었습니다. 본 변경사항은 이러한 상황에서 자동으로 웹 기반 카카오 계정 로그인으로 전환하여 사용자가 중단 없이 로그인 절차를 완료할 수 있도록 합니다. 이는 불필요한 오류 메시지를 줄이고 로그인 흐름을 더욱 원활하게 만듭니다.

Highlights

  • 카카오톡 로그인 실패 시 처리 개선: 카카오톡 앱으로 로그인을 시도하다가 실패하거나 사용자가 취소할 경우, 별도의 에러 메시지 없이 바로 카카오계정(웹) 로그인으로 전환되도록 로직을 개선했습니다.
  • ClientError 처리 세분화: 사용자가 로그인을 취소했을 때 발생하는 ClientErrorClientErrorCause.Cancelled로 식별하여 login_user_cancelled 메시지를 표시하도록 변경했습니다. 그 외의 ClientError는 기존과 동일하게 login_client_error 메시지를 사용합니다.
  • 로그인 로직 추상화: 카카오톡 로그인 가능 여부를 확인하고, 카카오톡 로그인 실패 시 웹 로그인으로 폴백하는 로직을 fetchAccessToken()이라는 새로운 private suspend 함수로 분리하여 코드의 가독성과 유지보수성을 높였습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

안녕하세요. 카카오톡 로그인 실패 시 웹 로그인으로 전환하는 로직을 추가하여 사용자 경험을 개선한 점이 좋습니다. 또한, 에러 처리 로직을 개선하여 더 안정적인 로그인 흐름을 만든 점도 긍정적입니다.

리뷰에서는 두 가지 개선점을 제안했습니다. 첫째, PR 설명에 언급된 대로 사용자 취소 케이스에 대해 커스텀 예외(KakaoUserCancelledException)를 사용하여 보다 명시적인 에러 처리가 가능하도록 하는 것입니다. 둘째, 카카오 SDK의 명세상 발생하지 않아야 할 예외 케이스에 대해 IllegalStateException을 사용해 잠재적인 문제를 명확히 드러내도록 수정하는 것을 제안했습니다.

이러한 변경들을 통해 코드의 견고성과 유지보수성을 더욱 향상시킬 수 있을 것입니다. 수정 사항을 검토해 주셔서 감사합니다.

Comment on lines +109 to 114
else ->
continuation.resumeWith(
Result.failure(
Exception(context.getString(R.string.login_user_cancelled)),
),
)

Choose a reason for hiding this comment

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

medium

handleLoginResult 함수의 when 표현식에서 tokenerror가 모두 nullelse 분기는 카카오 SDK 명세상 발생해서는 안 되는 경우입니다. 현재 코드는 이 예외적인 상황을 사용자가 로그인을 취소한 것으로 간주하고 있는데, 이는 잠재적인 SDK 문제를 숨기고 디버깅을 어렵게 만들 수 있습니다.

이러한 예기치 않은 상태는 IllegalStateException과 같이 더 명확한 예외를 발생시켜 처리하는 것이 좋습니다. 이를 통해 개발 중에 문제를 더 빨리 파악하고 대응할 수 있습니다.

Suggested change
else ->
continuation.resumeWith(
Result.failure(
Exception(context.getString(R.string.login_user_cancelled)),
),
)
else ->
continuation.resumeWith(
Result.failure(
IllegalStateException("Kakao login returned null for both token and error"),
),
)

@stopstone stopstone merged commit b110105 into dev Nov 20, 2025
1 check passed
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.

[FIX] 카카오톡 미로그인 시 카카오톡 소셜 로그인 안되는 현상 수정

2 participants