Skip to content

Conversation

@mark77234
Copy link
Collaborator

작업내용

  • 400 응답 에러 원인 파악 후 반영

Copilot AI review requested due to automatic review settings December 29, 2025 08:06
@mark77234 mark77234 linked an issue Dec 29, 2025 that may be closed by this pull request
@mark77234 mark77234 self-assigned this Dec 29, 2025
@mark77234 mark77234 merged commit a5229d4 into dev Dec 29, 2025
1 of 2 checks passed
@mark77234 mark77234 deleted the fix/58 branch December 29, 2025 08:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a 400 response error during sign-in by implementing proper FCM token refetch logic. The issue occurred when the cached FCM token was blank or invalid, causing the sign-in API call to fail.

Key Changes

  • Added automatic FCM token retrieval with fallback to Firebase if the cached token is blank
  • Implemented early return logic to abort sign-in when FCM token is unavailable
  • Added proper coroutine-based Firebase token fetching with cancellation support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +99 to +111
private suspend fun fetchFcmToken(): String = suspendCancellableCoroutine { cont ->
FirebaseMessaging.getInstance().token
.addOnCompleteListener { task ->
if (!cont.isActive) return@addOnCompleteListener
if (task.isSuccessful) {
cont.resume(task.result.orEmpty())
} else {
cont.resumeWithException(
task.exception ?: IllegalStateException("FCM token fetch failed")
)
}
}
}
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The addOnCompleteListener callback may execute on the main thread, but there's no guarantee which thread it will run on. This could cause the coroutine continuation to resume on an unexpected thread. Consider using addOnCompleteListener with an explicit executor or adding .addOnCompleteListener(Dispatchers.Main.asExecutor()) to ensure consistent threading behavior, or alternatively use Tasks.await() from the kotlinx-coroutines-play-services library which handles this more idiomatically.

Copilot uses AI. Check for mistakes.
fkal829 added a commit that referenced this pull request Jan 2, 2026
* feat: 로그인 api 연동(진짜최종)

* feat - 푸시알림 등록 (#54)

* feat: fcm 토큰 발급

* feat: 로그인 필드에 fcmtoken 추가

* feat: FCM 알림 기능 추가 및 기본 채널 설정

* feat: MainScreen에서 알림 권한 요청 기능 추가

* feat: 버전 업데이트 (1.0.1)

* feat - 회원가입, 필수정보입력 필드 업데이트 (#57)

* feat: 필수정보입력 실명 필드 추가

* feat: 회원가입 이름 필드 제거

* feat: 버전 업데이트 (1.0.2)

* feat: ADID 추가

* feat: FCM 토큰 가져오기 및 저장 로직 추가 (#59)

* feat: 구글로그인 응답로그 추가

* feat: 구글로그인 status 필드 대응

* fix: 구글로그인 버튼 위치 변경

---------

Co-authored-by: BYEONGCHAN LEE <[email protected]>
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] release 버전 로그인 400 에러

2 participants