Skip to content

[FEAT]: 네이버 로그인 SDK 연동#22

Merged
khyeji98 merged 4 commits into
developfrom
feat/#20
May 12, 2026
Merged

[FEAT]: 네이버 로그인 SDK 연동#22
khyeji98 merged 4 commits into
developfrom
feat/#20

Conversation

@duthd3
Copy link
Copy Markdown
Collaborator

@duthd3 duthd3 commented May 6, 2026

작업 내용

  • 네이버 로그인 SDK(NidThirdPartyLogin)를 Tuist 의존성에 추가했습니다.
  • 앱 시작 시 네이버 로그인 SDK 초기화 로직을 추가했습니다.
  • URL scheme / Info.plist 설정을 통해 네이버 로그인 콜백을 처리하도록 연결했습니다.
  • NaverLoginService를 추가하고 소셜 로그인 유스케이스에 네이버 로그인 분기를 연결했습니다.
  • 서버 로그인 이후 토큰 저장 흐름은 기존 구조에 맞춰 repository를 통해 처리하도록 유지했습니다.

변경 사항

  • Tuist/Package.swift, Package.resolved
    • 네이버 로그인 SDK 의존성 추가
  • Extension+TargetDependencySPM.swift
    • .SPM.nidThirdPartyLogin 추가
  • Project+InfoPlist.swift, InfoPlistDictionary.swift
    • NAVER_CLIENT_ID, NAVER_CLIENT_SECRET, NAVER_URL_SCHEME 설정 추가
    • 네이버 로그인 관련 URL scheme / query scheme 반영
  • BangawoApp.swift
    • 네이버 SDK 초기화
    • 네이버 로그인 콜백 처리
  • NaverLoginService.swift
    • 네이버 SDK 로그인 래핑 구현
  • SignInWithSocialUseCaseImpl.swift
    • .naver 로그인 분기 추가
  • AuthFactory.swift
    • 네이버 로그인 서비스 주입

확인 사항

  • tuist install
  • tuist generate
  • 네이버 로그인 SDK 의존성 해상 및 프로젝트 생성 성공 확인

참고

  • 현재 애플 로그인은 아직 구현되지 않았습니다.

체크리스트

  • 네이버 로그인 SDK 추가
  • 앱 초기화 및 URL 콜백 연결
  • 로그인 유스케이스 분기 연결
  • Tuist generate 성공 확인

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

네이버 로그인 SDK 연동 작업은 전반적으로 프로젝트의 아키텍처 원칙과 코딩 컨벤션에 맞춰 잘 구현되었습니다. NidThirdPartyLogin SDK 의존성 추가, Info.plist 설정, 앱 초기화 및 URL 콜백 처리, NaverLoginService 구현, 그리고 소셜 로그인 유스케이스 연동까지 명확하고 정확하게 처리되었습니다. 특별히 개선이 필요한 부분이나 문제가 발견되지 않았습니다.

@duthd3 duthd3 requested a review from khyeji98 May 6, 2026 14:43
Comment on lines +26 to +49
let displayName = (Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String) ?? ""
let bundleName = (Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String) ?? ""
let appName = displayName.isEmpty ? bundleName : displayName

let naverClientID = Bundle.main.infoDictionary?["NAVER_CLIENT_ID"] as? String ?? ""
let naverClientSecret = Bundle.main.infoDictionary?["NAVER_CLIENT_SECRET"] as? String ?? ""
let naverURLScheme = Bundle.main.infoDictionary?["NAVER_URL_SCHEME"] as? String ?? ""

if !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty {
NidOAuth.shared.initialize(
appName: appName,
clientId: naverClientID,
clientSecret: naverClientSecret,
urlScheme: naverURLScheme
)
Log.debug("👤 [Naver] Login SDK 초기화 완료")
} else {
Log.debug("appName: \(appName)")
Log.debug("clientId: \(naverClientID)")
Log.debug("clientSecret: \(naverClientSecret)")
Log.debug("urlScheme: \(naverURLScheme)")

Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.")
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

네이버 sdk 초기화 로직을 별도 private method로 분리하면 좀 더 가독성이 개선될 것 같아용!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

수정완료

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

네이버 로그인 SDK 연동 PR에 대한 코드 리뷰입니다. 전반적으로 Tuist 구성과 네이버 로그인 로직이 잘 구현되었습니다. BangawoApp.swift의 SDK 초기화 부분에서 guard let 구문을 사용하여 가독성을 개선할 수 있습니다.

let naverClientSecret = Bundle.main.infoDictionary?["NAVER_CLIENT_SECRET"] as? String ?? ""
let naverURLScheme = Bundle.main.infoDictionary?["NAVER_URL_SCHEME"] as? String ?? ""

if !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 [P4] Readability

SDK 초기화 조건 검사 시 if 대신 guard let을 사용하여 코드를 더 깔끔하게 구성하고 조기에 반환할 수 있습니다. 이는 가독성 향상에 도움이 됩니다.

Suggested change
if !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty {
guard !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty else {
Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.")
return
}
NidOAuth.shared.initialize(
appName: appName,
clientId: naverClientID,
clientSecret: naverClientSecret,
urlScheme: naverURLScheme
)
Log.debug("👤 [Naver] Login SDK 초기화 완료")

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

네이버 로그인 SDK 연동 작업에 대한 코드 리뷰입니다. 대부분의 변경 사항은 기능 추가 및 Tuist 설정에 대한 예상된 내용이었으며, 전반적으로 잘 구현되었습니다. 다만, BangawoApp.swift의 네이버 SDK 초기화 로직에 코드 스타일(들여쓰기) 문제가 있었고, NaverLoginService.swift에서 에러 처리 시 localizedDescription을 직접 사용하는 부분에 대한 개선이 필요합니다.

guard !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty else {
Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.")
return
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P5] Nitpick

guard 문의 닫는 중괄호 들여쓰기가 잘못되었습니다. guard 키워드와 같은 레벨로 맞춰주세요.

Suggested change
}
}

Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.")
return
}
NidOAuth.shared.initialize(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P5] Nitpick

NidOAuth.shared.initialize 호출문의 들여쓰기가 잘못되었습니다. guard 문 다음의 코드 블록으로 guard 키워드와 같은 레벨로 맞춰주세요.

Suggested change
NidOAuth.shared.initialize(
NidOAuth.shared.initialize(

clientId: naverClientID,
clientSecret: naverClientSecret,
urlScheme: naverURLScheme
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P5] Nitpick

initialize 메서드의 닫는 소괄호 들여쓰기가 잘못되었습니다. NidOAuth.shared.initialize(와 같은 레벨로 맞춰주세요.

Suggested change
)
)

clientSecret: naverClientSecret,
urlScheme: naverURLScheme
)
Log.debug("👤 [Naver] Login SDK 초기화 완료")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P5] Nitpick

Log.debug 호출문의 들여쓰기가 잘못되었습니다. NidOAuth.shared.initialize와 같은 레벨로 맞춰주세요.

Suggested change
Log.debug("👤 [Naver] Login SDK 초기화 완료")
Log.debug("👤 [Naver] Login SDK 초기화 완료")

urlScheme: naverURLScheme
)
Log.debug("👤 [Naver] Login SDK 초기화 완료")
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P5] Nitpick

initializeNaverLoginSDK() 함수의 닫는 중괄호 들여쓰기가 잘못되었습니다. private func 키워드와 같은 레벨로 맞춰주세요.

Suggested change
}
}

)
case let .failure(error):
Log.debug("❌ 네이버 로그인 실패: \(error.localizedDescription)")
continuation.resume(throwing: SocialAuthClientError.underlying(error.localizedDescription))
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] Major

에러를 전달할 때 error.localizedDescription 대신 원본 error 객체를 직접 래핑하거나, 도메인 계층에서 정의된 특정 에러 타입으로 매핑하는 것이 좋습니다. localizedDescription은 주로 사용자에게 표시하기 위한 목적이며, 디버깅이나 프로그램적인 에러 처리에 필요한 상세 정보가 부족할 수 있습니다. underlying 케이스를 사용한다면 Error 프로토콜을 따르는 원본 error를 직접 넘겨주는 것이 더 나은 관행입니다.

Suggested change
continuation.resume(throwing: SocialAuthClientError.underlying(error.localizedDescription))
continuation.resume(throwing: SocialAuthClientError.underlying(error))

@khyeji98 khyeji98 merged commit 6f492fd into develop May 12, 2026
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.

2 participants