Skip to content

Refactor/#763#771

Open
opficdev wants to merge 8 commits into
developfrom
refactor/#763
Open

Refactor/#763#771
opficdev wants to merge 8 commits into
developfrom
refactor/#763

Conversation

@opficdev

Copy link
Copy Markdown
Owner

🔗 연관된 이슈

🎯 의도

  • Google 인증 화면에 Hosting 주소가 노출되는 callback/session/ticket 방식 제거
  • GoogleSignIn에서 발급한 일회성 serverAuthCode만 전달하는 인증 구조로 전환
  • Staging과 Release의 Google OAuth 설정 불일치를 배포 전에 확인할 수 있도록 검증 보강

📝 작업 내용

📌 요약

  • GoogleSignIn 패키지와 앱 URL 콜백 처리 추가
  • Google 로그인과 계정 연결을 serverAuthCode 기반 API로 전환
  • Google 로그아웃 시 로컬 GoogleSignIn 세션 정리 추가
  • 앱의 기존 Google ticket/session endpoint 호출 계약 제거
  • 환경별 Google OAuth 설정과 IPA 설정값 검증 추가
  • Google 인증 오류와 endpoint 관련 테스트 추가

🔍 상세

GoogleSignIn 연동

  • GoogleSignIn 패키지 의존성과 Infra 모듈 연결 추가
  • AppDelegate.application(_:open:options:)에서 GoogleSignIn URL 콜백 처리
  • TopViewControllerProvider를 통한 GoogleSignIn 표시 화면 탐색
  • GoogleSignIn 취소 오류를 기존 소셜 로그인 취소 오류로 변환
  • 일반 로그아웃 시 GIDSignIn.sharedInstance.signOut() 호출 추가

로그인 및 계정 연결

  • 로그인 시 serverAuthCodePOST /auth/google/authorization-code/custom-token으로 전달
  • 반환된 custom token을 이용한 로그인 처리
  • 계정 연결 시 ID token과 serverAuthCodePUT /auth/google/authorization-code/account-link로 전달
  • 계정 연결 완료 후 사용자 정보 갱신
  • 앱에서 Google ID token, access token, refresh token을 전달하거나 저장하지 않는 구조 적용

기존 인증 흐름 정리

  • OAuthAuthenticationTicketRequester를 사용하던 Google 전용 ticket/session 호출 제거
  • Google 계정 연결 해제와 회원 탈퇴 흐름 유지
  • GitHub callback/session/ticket 인증 흐름 유지

환경 설정 및 배포 검증

  • Info.plistGIDClientID, GIDServerClientID, reversed client ID URL scheme 연결
  • Staging과 Release별 CLIENT_ID, GID_SERVER_CLIENT_ID, REVERSED_CLIENT_ID 확인 추가
  • IPA의 GIDClientID와 bundled GoogleService-Info.plistCLIENT_ID 일치 여부 확인
  • reversed client ID URL scheme 포함 여부 확인
  • 설정값 불일치 오류에서 실제 OAuth 값 가림 처리

📸 영상 / 이미지 (Optional)

  • 없음

@opficdev opficdev self-assigned this Jul 26, 2026
@opficdev

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78a1ff9335

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
GoogleSignInURLHandler.handle(url)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Google 콜백을 scene URL 경로에서 처리하세요

UIApplicationSceneManifest와 SwiftUI WindowGroup을 사용하는 이 앱에서는 기존 scene으로 돌아오는 OAuth URL이 UIApplicationDelegate.application(_:open:options:)가 아니라 scene의 .onOpenURL로 전달됩니다. 현재 RootView.swift의 핸들러는 해당 URL을 widget deep link로만 검사한 뒤 반환하므로, REVERSED_CLIENT_ID 콜백에서 GIDSignIn.sharedInstance.handle이 호출되지 않아 signIn(withPresenting:)가 완료되지 않습니다. App이 소유한 SwiftUI URL 진입점에서 GoogleSignInURLHandler로 전달해야 합니다. .agents/rules/architecture.mdL165-L165

Useful? React with 👍 / 👎.

}

try Auth.auth().signOut()
GIDSignIn.sharedInstance.signOut()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 연결된 Google 세션도 로그아웃 시 정리하세요

GIDSignIn.sharedInstance.signOut()AuthenticationRepositoryImpl.signOut()이 Firestore의 currentProvider로 Google을 선택했을 때만 실행됩니다. 이 저장소가 지원하는 것처럼 Apple 또는 GitHub가 현재 provider이고 Google이 연결된 상태에서는 link()가 영속적인 GID 세션을 만들지만 일반 로그아웃은 해당 provider의 서비스만 호출하므로 이 정리가 누락됩니다. 그 결과 앱에서 로그아웃한 뒤에도 이전 Google 계정 세션이 남아 다음 Google 인증이 이전 사용자의 상태에서 시작될 수 있으므로, Google SDK 세션 정리를 현재 provider와 무관한 로그아웃 경로로 옮겨야 합니다.

Useful? React with 👍 / 👎.

Comment on lines +13 to +16
let rootViewController = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.flatMap(\.windows)
.first(where: \.isKeyWindow)?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 요청을 시작한 window scene에서 인증 UI를 표시하세요

connectedScenes는 순서가 없는 집합인데 이 코드는 scene의 활성 상태나 요청 출처를 확인하지 않고 첫 isKeyWindow를 선택합니다. 앱이 기본 화면과 Todo editor를 별도 WindowGroup으로 제공하므로 다른 scene이 연결되어 있거나 background에 남아 있으면, main scene에서 시작한 Google 로그인·계정 연결이 editor 또는 background scene의 controller를 선택해 다른 창에 표시되거나 유효하지 않은 presentation context로 실패할 수 있습니다. 전역 첫 window 대신 요청을 시작한 view의 UIWindowScene에 속한 controller를 전달해야 합니다.

Useful? React with 👍 / 👎.

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.

Google 인증을 GoogleSignIn serverAuthCode 흐름으로 전환한다

1 participant