Supabase Auth
Set up Supabase Auth for email, social, and phone authentication with Row Level Security integration.
Overview
The auth system supports over 20 social providers including Google, Apple, GitHub, and Azure. It provides server-side auth helpers for Next.js, SvelteKit, and Remix that handle cookie-based session management. PKCE (Proof Key for Code Exchange) flow is used by default for enhanced security in server-side rendering scenarios.
Supabase Auth includes built-in email templates, redirect URL configuration, and JWT customization. The integration with RLS means you can write PostgreSQL policies like `auth.uid() = user_id` to restrict data access at the database level, eliminating the need for authorization logic in your application code.
Who Is This For?
- Add email/password and social login to a web app
- Implement Row Level Security policies based on auth
- Set up magic link passwordless authentication
- Handle server-side auth in Next.js with Supabase SSR
Installation
npm install @supabase/supabase-js @supabase/ssr Configuration
// lib/supabase/server.ts
import { createServerClient } from "@supabase/ssr"
import { cookies } from "next/headers"
export function createClient() {
const cookieStore = cookies()
return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{ cookies: { getAll: () => cookieStore.getAll() } }
)
} Explore AI Tools
Discover the best AI tools that complement your skills
Read AI & Design Articles
Tips and trends in the world of design and AI
Related Servers
Snyk Security Scan
Detect vulnerabilities in your dependencies and application code. Get actionable remediation advice and automatic fix pull requests.
SonarQube Code Quality
Run continuous code quality and security analysis to catch bugs, code smells, and vulnerabilities before they reach production.
OWASP ZAP Security Testing
Perform automated web application security testing to find common vulnerabilities like XSS, injection flaws, and misconfigurations.