From b687f4de04080583ade4b60d14a76519276b74b9 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 30 Sep 2025 04:50:31 +0000 Subject: [PATCH] Add signInWithOAuth to supabase auth proxy cgen-e5aaa915f7f94248bd15ad7831b10207 --- client/lib/supabase.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/client/lib/supabase.ts b/client/lib/supabase.ts index 86e8520c..755c76b4 100644 --- a/client/lib/supabase.ts +++ b/client/lib/supabase.ts @@ -101,6 +101,26 @@ export const supabase = new Proxy(supabaseClient || {}, { ); } }, + + // OAuth sign-in (GitHub/Google). Falls back to mock in development. + signInWithOAuth: async (opts: any) => { + const provider = opts?.provider; + if (isSupabaseConfigured && target && target.auth && typeof target.auth.signInWithOAuth === 'function') { + try { + return await target.auth.signInWithOAuth(opts); + } catch (error: any) { + console.warn('Supabase signInWithOAuth failed:', error?.message || error); + try { + return await mockAuth.signInWithOAuth(provider); + } catch (e) { + throw error; + } + } + } + + // Mock fallback + return await mockAuth.signInWithOAuth(provider); + }, signOut: async () => { if (isSupabaseConfigured && target && target.auth) { try {