feat(auth): 네이티브 구글 로그인 iOS 클라이언트 ID 설정(iOSClientId/iOSServerClientId)
CI / build (push) Failing after 13m33s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-07-12 11:30:10 +09:00
parent f2d29a838a
commit d4839678d1
+15 -1
View File
@@ -5,8 +5,13 @@ import { SocialLogin } from '@capgo/capacitor-social-login'
* 네이티브(Capacitor) 구글 로그인. * 네이티브(Capacitor) 구글 로그인.
* 웹뷰에서는 GIS(팝업/FedCM)가 동작하지 않으므로, 앱에서는 이 네이티브 흐름을 사용한다. * 웹뷰에서는 GIS(팝업/FedCM)가 동작하지 않으므로, 앱에서는 이 네이티브 흐름을 사용한다.
* 받은 ID 토큰은 웹 GIS 와 동일하게 백엔드 /api/auth/google 로 검증한다. * 받은 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 = '' let initializedFor = ''
/** 네이티브 플랫폼(iOS/Android) 여부 — 웹은 기존 GIS 사용. */ /** 네이티브 플랫폼(iOS/Android) 여부 — 웹은 기존 GIS 사용. */
@@ -20,7 +25,16 @@ export function isNativeGoogleAvailable(): boolean {
*/ */
export async function signInWithGoogle(webClientId: string): Promise<string> { export async function signInWithGoogle(webClientId: string): Promise<string> {
if (initializedFor !== webClientId) { 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 initializedFor = webClientId
} }
const res = await SocialLogin.login({ const res = await SocialLogin.login({