This guide provides instructions for configuring authentication providers in Supabase for your full-stack application. The boilerplate supports multiple authentication methods, including OAuth providers like Google and LinkedIn.
- Prerequisites
- General Setup Steps
- Google OAuth
- LinkedIn OAuth
- Additional Providers
- Email/Password Authentication
- Advanced Configuration
Before setting up authentication providers:
- Create a Supabase account and project
- Set up your application's
.env
file with your Supabase credentials:SUPABASE_URL
SUPABASE_ANON_KEY
SUPABASE_SERVICE_KEY
For all OAuth providers, you'll need to:
- Register your application with the provider
- Configure the callback URL
- Add the provider credentials to Supabase
The general callback URL format for Supabase is:
https://[YOUR_PROJECT_REF].supabase.co/auth/v1/callback
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Select "Web application" as the application type
- Add a name for your OAuth client
- Add the following authorized redirect URI:
https://[YOUR_PROJECT_REF].supabase.co/auth/v1/callback
- Click "Create" to generate your Client ID and Client Secret
- Go to your Supabase project dashboard
- Navigate to "Authentication" > "Providers"
- Find "Google" in the list of providers and click "Edit"
- Toggle the "Enabled" switch to on
- Enter your Google Client ID and Client Secret
- Save your changes
The boilerplate already includes Google authentication in the frontend code:
// frontend/services/supabase.ts
export async function signInWithGoogle() {
return supabase.auth.signInWithOAuth({
provider: 'google',
options: {
redirectTo: `${window.location.origin}/auth/callback`,
},
});
}
- Go to LinkedIn Developer Portal
- Click "Create App" to create a new application
- Fill in the required information for your app
- Under the "Auth" tab, add the following OAuth 2.0 Redirect URL:
https://[YOUR_PROJECT_REF].supabase.co/auth/v1/callback
- Request the following OAuth scopes:
r_emailaddress
r_liteprofile
- Note your Client ID and Client Secret
- Go to your Supabase project dashboard
- Navigate to "Authentication" > "Providers"
- Find "LinkedIn" in the list of providers and click "Edit"
- Toggle the "Enabled" switch to on
- Enter your LinkedIn Client ID and Client Secret
- Save your changes
The boilerplate already includes LinkedIn authentication in the frontend code:
// frontend/services/supabase.ts
export async function signInWithLinkedIn() {
return supabase.auth.signInWithOAuth({
provider: 'linkedin',
options: {
redirectTo: `${window.location.origin}/auth/callback`,
},
});
}
- Go to GitHub Developer Settings
- Click "New OAuth App"
- Fill in the application details
- Set the Authorization callback URL to:
https://[YOUR_PROJECT_REF].supabase.co/auth/v1/callback
- Register the application and note your Client ID
- Generate a Client Secret and note it down
- Go to your Supabase project dashboard
- Navigate to "Authentication" > "Providers"
- Find "GitHub" in the list of providers and click "Edit"
- Toggle the "Enabled" switch to on
- Enter your GitHub Client ID and Client Secret
- Save your changes
Add GitHub authentication to your frontend code:
// Add to frontend/services/supabase.ts
export async function signInWithGitHub() {
return supabase.auth.signInWithOAuth({
provider: 'github',
options: {
redirectTo: `${window.location.origin}/auth/callback`,
},
});
}
- Go to the Twitter Developer Portal
- Create a new project and app
- In your app settings, set up User Authentication
- Set the callback URL to:
https://[YOUR_PROJECT_REF].supabase.co/auth/v1/callback
- Request the necessary permissions (read email)
- Note your API Key and API Secret
- Go to your Supabase project dashboard
- Navigate to "Authentication" > "Providers"
- Find "Twitter" in the list of providers and click "Edit"
- Toggle the "Enabled" switch to on
- Enter your Twitter API Key and API Secret
- Save your changes
Add Twitter authentication to your frontend code:
// Add to frontend/services/supabase.ts
export async function signInWithTwitter() {
return supabase.auth.signInWithOAuth({
provider: 'twitter',
options: {
redirectTo: `${window.location.origin}/auth/callback`,
},
});
}
Setting up Apple Sign-In is more complex due to additional requirements:
- You need an Apple Developer account ($99/year)
- You must have a domain and verify ownership
- You need to generate and manage certificates
For detailed instructions, refer to the Supabase Apple Login Guide.
To enable email/password authentication:
- Go to your Supabase project dashboard
- Navigate to "Authentication" > "Providers"
- Find "Email" in the list of providers and click "Edit"
- Configure your preferred settings:
- Enable/disable "Confirm email"
- Set up email templates
- Configure security options
- Save your changes
For more advanced authentication configuration, such as:
- Custom email templates
- Custom redirect URLs
- Multi-factor authentication
- Role-based access control
Refer to the Supabase Authentication Documentation.