From d4839678d16ed3530fc2fcdaa69edc433c263035 Mon Sep 17 00:00:00 2001 From: ByungCheol Date: Sun, 12 Jul 2026 11:30:10 +0900 Subject: [PATCH] =?UTF-8?q?feat(auth):=20=EB=84=A4=EC=9D=B4=ED=8B=B0?= =?UTF-8?q?=EB=B8=8C=20=EA=B5=AC=EA=B8=80=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?iOS=20=ED=81=B4=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8=20ID=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95(iOSClientId/iOSServerClientId)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- src/lib/googleAuth.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/googleAuth.ts b/src/lib/googleAuth.ts index bfdb00c..7158bce 100644 --- a/src/lib/googleAuth.ts +++ b/src/lib/googleAuth.ts @@ -5,8 +5,13 @@ import { SocialLogin } from '@capgo/capacitor-social-login' * 네이티브(Capacitor) 구글 로그인. * 웹뷰에서는 GIS(팝업/FedCM)가 동작하지 않으므로, 앱에서는 이 네이티브 흐름을 사용한다. * 받은 ID 토큰은 웹 GIS 와 동일하게 백엔드 /api/auth/google 로 검증한다. + * - Android: serverClientId(webClientId) 로 토큰을 받으므로 aud = 웹 클라 ID + * - iOS: iOS 클라 ID 로 로그인 → aud = iOS 클라 ID (백엔드가 web/iOS 둘 다 허용) */ +// iOS 구글 클라이언트 ID (공개값). iOS 네이티브 로그인용. +const IOS_CLIENT_ID = '913571348421-5a9k5kosv2mfosskcc3tllv5h1h9nfrn.apps.googleusercontent.com' + let initializedFor = '' /** 네이티브 플랫폼(iOS/Android) 여부 — 웹은 기존 GIS 사용. */ @@ -20,7 +25,16 @@ export function isNativeGoogleAvailable(): boolean { */ export async function signInWithGoogle(webClientId: string): Promise { if (initializedFor !== webClientId) { - await SocialLogin.initialize({ google: { webClientId } }) + const google: { + webClientId: string + iOSClientId?: string + iOSServerClientId?: string + } = { webClientId } + if (Capacitor.getPlatform() === 'ios') { + google.iOSClientId = IOS_CLIENT_ID + google.iOSServerClientId = webClientId + } + await SocialLogin.initialize({ google }) initializedFor = webClientId } const res = await SocialLogin.login({