Supabase Auth Integration for Website
Supabase Auth is a component of the Supabase platform, built on GoTrue. Stores users in PostgreSQL auth.users table, generates JWT with customizable claims, and supports magic links, OTP, OAuth, and SAML. Convenient if backend is already on Supabase — authorization is embedded directly in RLS policies.
What's Included
- Install
@supabase/supabase-js, initialize client withanon keyandservice role key - Configure email provider (SMTP via Resend, Postmark, or built-in Supabase SMTP)
- Implement login via
supabase.auth.signInWithOAuth({ provider: 'google' })and email OTP - Set up Row Level Security: policies
auth.uid() = user_idfor data isolation per user - Server-side JWT verification in Next.js via
createServerClientfrom@supabase/ssr - Profile synchronization: trigger
on auth.users insert → public.profiles insert - Configure redirect URLs, PKCE flow for mobile clients
RLS Integration Features
-- User sees only their own records
CREATE POLICY "own_data" ON orders
FOR SELECT USING (auth.uid() = user_id);
This allows making requests directly with client via anon key — database itself filters data. No need for separate API layer for basic CRUD operations.
Timeline
Email + OAuth (Google) + basic RLS policies — 1–2 working days. Complex scenarios with multi-tenancy and custom SAML providers — 3–4 days.







