Authentication
Using Supabase (reccommended)
Follow these instructions to set up supabase in your project
Set
requireAuth
totrue
inconfig.js
. This will force the user to login before accessing the app
Not Using Supbase
Open
AuthProvider.ts
Re-implement the
useEffect
usingonAuthStateChange
, and setuserID
andisAuthInitialized
useEffect(() => {
supabase.auth.onAuthStateChange((_event, session) => {
if (session) {
setUserId(session.user.id)
} else {
setUserId("")
}
setIsAuthInitialized(true)
})
}, [])
Re-implement the functions
handleSignUp
,handlesignIn
,handlesignOut
, andhandlesignInGuest
inAuthProvider.tsx
Last updated