docs/content/docs/self-hosting/oauth-setup.mdx
Enable users to sign in with their favorite social accounts like GitHub, Google, and more.
OAuth lets users log in using accounts they already have (like GitHub or Google) instead of creating new passwords. It's faster and more secure.
For detailed instructions, see the Supabase GitHub OAuth documentation.
Your Onlook Apphttp://localhost:3000 (or your production domain)http://localhost:54321/auth/v1/callbackhttps://your-production-domain/auth/v1/callbackAdd the GitHub provider to your login page:
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(supabaseUrl, supabaseKey)
// Add GitHub login button
const signInWithGitHub = async () => {
const { error } = await supabase.auth.signInWithOAuth({
provider: 'github'
})
if (error) console.error('Error:', error)
}
For detailed instructions, see the Supabase Google OAuth documentation.
http://localhost:54321/auth/v1/callbackhttps://your-production-domain/auth/v1/callbackconst signInWithGoogle = async () => {
const { error } = await supabase.auth.signInWithOAuth({
provider: 'google'
})
if (error) console.error('Error:', error)
}
Supabase supports many OAuth providers. For comprehensive setup instructions for all providers, see the Supabase Social Login documentation.
Popular providers include:
Note: For each provider, remember to add both local (
http://localhost:54321/auth/v1/callback) and production (https://your-production-domain/auth/v1/callback) redirect URIs to avoid redirect_uri_mismatch errors.
Make sure your .env.local has:
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
"Invalid redirect URI"
http://localhost:54321/auth/v1/callback"Client ID not found"
"Access denied"
Once OAuth is working:
That's it! Your users can now sign in with their social accounts. 🎉