Magic Links

Magic Links allow users to sign in without a password. They receive an email with a secure link that logs them in automatically.

How It Works

1. User enters their email address

2. They receive an email with a magic link

3. Clicking the link logs them in automatically

4. The link expires after a set time (default: 1 hour)

Implementation

Magic Links are handled by Supabase Auth. The implementation is already included in the boilerplate.

app/auth/magic-link/page.tsx
1import { createClient } from '@/lib/supabase/client';
2
3const supabase = createClient();
4
5// Send magic link
6const { error } = await supabase.auth.signInWithOtp({
7  email: 'user@example.com',
8  options: {
9    emailRedirectTo: 'https://yoursite.com/auth/callback'
10  }
11});