Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Return default session if self hosted

Joshen Lim5f428b09c45c
diff --git a/studio/lib/auth.tsx b/studio/lib/auth.tsx
index a2066c37ff0..c9a61bfaf84 100644
--- a/studio/lib/auth.tsx
+++ b/studio/lib/auth.tsx
@@ -13,6 +13,29 @@ import {
} from 'react'
import { GOTRUE_ERRORS } from './constants'
+const DEFAULT_SESSION: any = {
+ access_token: undefined,
+ expires_at: 0,
+ expires_in: 0,
+ refresh_token: '',
+ token_type: '',
+ user: {
+ aud: '',
+ app_metadata: {},
+ confirmed_at: '',
+ created_at: '',
+ email: '',
+ email_confirmed_at: '',
+ id: '',
+ identities: [],
+ last_signed_in_at: '',
+ phone: '',
+ role: '',
+ updated_at: '',
+ user_metadata: {},
+ },
+}
+
/* Auth Context */
export type AuthContext = { refreshSession: () => Promise<Session | null> } & (
@@ -123,7 +146,7 @@ export const AuthProvider = ({ children }: PropsWithChildren<AuthProviderProps>)
return { session, isLoading: false, refreshSession } as const
}
- return { session: null, isLoading: isLoading, refreshSession } as const
+ return { session: DEFAULT_SESSION, isLoading: isLoading, refreshSession } as const
}, [session, isLoading, refreshSession])
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>