Skip to content

Apple 로그인을 공통 웹 인증 session과 ticket 흐름으로 전환한다 #719

Description

@opficdev

문제

현재 AppleAuthenticationServiceImpl은 서버 challenge를 사용하지만 ASAuthorizationController를 통해 authorization code와 Apple 사용자 정보를 iOS에서 직접 받습니다.

GitHub에서 공급자 공통 OAuth session과 ticket 모델을 도입한 뒤 Apple이 기존 전용 모델을 유지하면 다음 타입과 흐름이 중복됩니다.

  • AppleChallengeResponse
  • AppleCustomTokenRequest
  • AppleAccountLinkRequest
  • AppleAuthResponse
  • AppleSignInDelegate
  • Apple 전용 custom token과 operation 응답

Apple도 서버 callback 방식으로 통일하려면 네이티브 credential 전달 대신 웹 Sign in with Apple URL과 ticket을 사용해야 합니다.

결정 사항

  • ASAuthorizationController 기반 인증을 ASWebAuthenticationSession으로 전환합니다.
  • 서버에서 Apple 인증 URL을 받아 공통 웹 인증 helper로 표시합니다.
  • callback에서는 공통 ticket만 받습니다.
  • 다음 공통 모델을 GitHub와 공유합니다.
    • OAuthAuthenticationSessionRequest
    • OAuthAuthenticationSessionResponse
    • OAuthAuthenticationTicketRequest
    • FirebaseCustomTokenResponse
  • 계정 작업 성공 응답은 EmptyAPIResponse를 사용합니다.
  • Apple provider 오류와 사용자 취소 결과는 기존 앱 오류 계약을 유지합니다.
  • FirebaseAuth, Firestore, Messaging은 기존대로 Infra에서 사용합니다.

기대 동작

  • Apple 로그인 화면은 앱 내부 시스템 브라우저 시트로 표시됩니다.
  • iOS는 Apple authorization code, identity token, nonce, 사용자 payload를 받지 않습니다.
  • ticket 교환으로 받은 Firebase custom token만 즉시 사용합니다.
  • 서버가 설정한 Firebase displayName을 기존 UserService.upsertUser가 저장합니다.
  • 로그인 취소는 nil, 연결 취소는 false를 반환합니다.
  • 계정 연결·해제 후 currentUser.reload()을 호출합니다.

수정 방향

  • AppleAuthResponse, AppleSignInDelegate, challenge 요청 모델을 제거합니다.
  • AppleCustomTokenResponse를 공통 FirebaseCustomTokenResponse로 대체합니다.
  • AppleOperationResponseEmptyAPIResponse로 대체합니다.
  • Apple endpoint를 공통 session·ticket request로 변경합니다.
  • AuthenticationServicesASWebAuthenticationSession 사용을 위해 Infra에 유지합니다.
  • native Apple challenge endpoint 사용처가 없는지 확인한 뒤 제거합니다.

수용 기준

  • iOS에서 Apple credential을 직접 해석하지 않습니다.
  • GitHub와 Apple이 동일한 session·ticket·custom token 타입을 사용합니다.
  • 공통 모델에 Apple 전용 필드가 포함되지 않습니다.
  • 기존 사용자 이름과 초기 데이터 생성 동작이 유지됩니다.
  • provider 연결·해제와 회원탈퇴 후처리가 유지됩니다.
  • 새 target dependency가 추가되지 않습니다.
  • SwiftLint와 iOS build가 통과합니다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions