Fix: Resolve authentication state recognition issues

This commit is contained in:
gpt-engineer-app[bot]
2025-10-11 00:54:27 +00:00
parent 9c5487baff
commit 06ed528d76
4 changed files with 24 additions and 4 deletions

View File

@@ -93,6 +93,8 @@ function AuthProviderComponent({ children }: { children: React.ReactNode }) {
const {
data: { subscription },
} = supabase.auth.onAuthStateChange((event, session) => {
console.log('[Auth] State change:', event, 'User:', session?.user?.email || 'none');
if (!isMountedRef.current) return;
const currentEmail = session?.user?.email;
@@ -100,6 +102,7 @@ function AuthProviderComponent({ children }: { children: React.ReactNode }) {
// Explicitly handle SIGNED_IN event for iframe compatibility
if (event === 'SIGNED_IN' && session) {
console.log('[Auth] SIGNED_IN detected, setting session and user');
setSession(session);
setUser(session.user);
setLoading(false);