Ramble-FE / services / oauth / oauth.utils.ts
oauth.utils.ts
Raw
import { GOOGLE_CLIENT_ID_CONFIG } from "@/config";
import { Platform } from "react-native";

let cachedGoogleClientId: string | null = null;

export function getGoogleClientId(): string {
    if (cachedGoogleClientId) return cachedGoogleClientId;

    const config = GOOGLE_CLIENT_ID_CONFIG;
    const clientId = Platform.select({
        ios: config.ios,
        android: config.android,
        default: config.web,
    });

    if (!clientId) {
        throw new Error("Google Client ID가 설정되지 않았습니다");
    }

    cachedGoogleClientId = clientId;
    return clientId;
}