feat(auth): iOS 애플 로그인 버튼 — Sign in with Apple(App Store 4.8 대응)
- @capacitor-community/apple-sign-in + LoginModal Apple 버튼(iOS 전용, HIG 검은 버튼) - appleAuth 네이티브 래퍼 + authApi/auth store appleLogin - SPM capacitor-swift-pm 8.x 로 패치(patch-package) — @capawesome 구글 플러그인과 iOS 공존 - App.entitlements(applesignin) 준비 — Xcode 'Sign in with Apple' Capability 추가 시 사용 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// 네이티브 Sign in with Apple 래퍼 (iOS 전용). 플러그인은 지연 import.
|
||||
// 반환된 identity token(JWT)의 aud 는 앱 번들 ID → 백엔드 /api/auth/apple 가 JWKS 로 검증한다.
|
||||
import { Capacitor } from '@capacitor/core'
|
||||
|
||||
// Apple 로그인은 iOS 네이티브에서만 노출한다(웹/안드로이드는 별도 흐름 필요 — 현재 미지원).
|
||||
export function isNativeApple() {
|
||||
return Capacitor.getPlatform() === 'ios'
|
||||
}
|
||||
|
||||
// Sign in with Apple 수행 → { identityToken, name }.
|
||||
// 이름(givenName/familyName)은 애플이 '최초 인증 시에만' 주므로 신규 가입 채움용으로 함께 반환.
|
||||
export async function nativeAppleCredential() {
|
||||
const { SignInWithApple } = await import('@capacitor-community/apple-sign-in')
|
||||
const result = await SignInWithApple.authorize({
|
||||
clientId: 'kr.sblog.slimbudget',
|
||||
redirectURI: 'https://app.sblog.kr/auth/apple/callback',
|
||||
scopes: 'email name',
|
||||
})
|
||||
const r = result?.response || {}
|
||||
const name = [r.givenName, r.familyName].filter(Boolean).join(' ').trim() || null
|
||||
return { identityToken: r.identityToken || null, name }
|
||||
}
|
||||
Reference in New Issue
Block a user