Authentication

Using Supabase (reccommended)

  1. Follow these instructions to set up supabase in your project

  2. Set requireAuth to true in config.js. This will force the user to login before accessing the app

Troubleshooting

  1. Make sure config.supabase.isSetup is true

  2. Make sure config.requireAuth is true

  3. Make sure your supabase url and anon key is valid is valid

Not Using Supbase

  1. Open AuthProvider.ts

  2. Re-implement the useEffect using onAuthStateChange, and set userID and isAuthInitialized

AuthProvider.ts
useEffect(() => {
  supabase.auth.onAuthStateChange((_event, session) => {
    if (session) {
      setUserId(session.user.id)
    } else {
      setUserId("")
    }
    setIsAuthInitialized(true)
  })
}, [])
  1. Re-implement the functions handleSignUp, handlesignIn, handlesignOut, and handlesignInGuest in AuthProvider.tsx

Last updated