From 56436bcfb7b46698c85090c16afb1984da14e315 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 30 Sep 2025 04:50:13 +0000 Subject: [PATCH] Add signInWithOAuth mock and proxy support cgen-41599b5f62b9482b87186aa5eed0c264 --- client/lib/mock-auth.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/client/lib/mock-auth.ts b/client/lib/mock-auth.ts index c114cdd7..f8df6563 100644 --- a/client/lib/mock-auth.ts +++ b/client/lib/mock-auth.ts @@ -84,6 +84,32 @@ class MockAuthService { }; } + // Simulate OAuth sign-in flow for development + async signInWithOAuth(provider: string) { + const user: MockUser = { + id: `mock_oauth_${provider}_${Date.now()}`, + email: `${provider}_user_${Date.now()}@example.com`, + created_at: new Date().toISOString(), + }; + + this.currentUser = user; + this.currentSession = { + user, + access_token: 'mock_oauth_token_' + Date.now(), + }; + + // Save to localStorage + localStorage.setItem('mock_user', JSON.stringify(user)); + + // Notify auth state change after a short delay to simulate redirect + setTimeout(() => this.notifyAuthChange('SIGNED_IN'), 50); + + return { + data: { user, session: this.currentSession }, + error: null, + }; + } + async signOut() { this.currentUser = null; this.currentSession = null;