Authentication is how users log in to your app. In this repo, Supabase handles
the auth backend and the app handles the UI and callback flow.
What This Auth System Does
The repo already includes:- a login page at
/auth - magic link sign-in
- optional Google OAuth sign-in
- session handling
- redirects into the signed-in app
/authfor the sign-in page/auth/confirmfor the callback/auth/completefor the post-auth handoff/api/authfor magic link initiation/api/auth/googlefor Google sign-in initiation
Minimum Auth Setup
You only need the normal Supabase env vars:Magic Link Setup
Magic links are the easiest way to start. In Supabase:- Open
Authentication -> URL Configuration - Set Site URL to
http://localhost:3000 - Add
http://localhost:3000/auth/confirmas a redirect URL - Add your production domain and
https://yourdomain.com/auth/confirmtoo - Make sure email sign-in is enabled
Google OAuth Setup
Google sign-in is optional. To enable it:- Create Google OAuth credentials in Google Cloud
- Open Supabase
Authentication -> Providers - Enable Google
- Paste your Google client ID and secret into Supabase
- Keep the same callback URL pattern based on
/auth/confirm
What Happens When A User Signs In
- the user starts on
/auth - Supabase sends them through the login flow
- Supabase returns to
/auth/confirm - the app exchanges the code for a session
- the app sends the user into the signed-in area
Verification Checklist
Your auth setup is working if:- magic link emails arrive
- clicking the link signs you in
- Google sign-in works if you enabled it
/homeloads without bouncing back to/auth
Common Mistakes
- wrong Supabase Site URL
- missing
/auth/confirmredirect URL - wrong Google OAuth credentials
- editing env vars without restarting the app

