Facebook Login remains one of the most-used social sign-in options for consumer apps — and one of the most frustrating to configure on a self-hosted Supabase instance. On Supabase Cloud you flip a toggle in the dashboard. Self-hosted, there is no toggle: you're editing GoTrue environment variables by hand, restarting containers, and then fighting Meta's App Review process on top of it. If you've already configured other auth providers on your instance, the GoTrue side will feel familiar; it's the Meta side that catches people out.
This guide walks through the full setup: creating the Meta app, wiring the environment variables into Docker Compose, taking the app live, and fixing the errors that show up in real deployments — including the one where Facebook silently returns no email address.
How Facebook OAuth Works on Self-Hosted Supabase
The flow is the same OAuth 2.0 dance as Google or GitHub:
- Your app calls
signInWithOAuth({ provider: 'facebook' }) - The user is redirected to Facebook and approves the login
- Facebook redirects back to your GoTrue callback URL:
https://<your-api-domain>/auth/v1/callback - GoTrue exchanges the code for a token, fetches the profile, and creates or signs in the user
Two self-hosted-specific facts matter before you start:
- Facebook rejects plain HTTP callback URLs. Your Supabase API needs to be served over HTTPS on a real domain —
localhostis the only exception. If your instance is still raw-IP-and-port, set up a custom domain with SSL first. - There is no dashboard toggle. Self-hosted Supabase Studio does not configure auth providers; everything goes through GoTrue environment variables (the official self-hosted OAuth docs confirm this).
Step 1: Create the Meta App
Head to developers.facebook.com and sign in with a Facebook account.
- Create App → choose Authenticate and request data from users with Facebook Login as the use case
- Pick Consumer as the app type if prompted, name the app, and create it
- From the app dashboard, under Add Products, click Set up on Facebook Login
- Skip the Quickstart wizard — you don't need their SDK snippets
- In the left sidebar: Facebook Login → Settings
In Valid OAuth Redirect URIs, enter your GoTrue callback exactly:
https://api.yourdomain.com/auth/v1/callback
This must match character-for-character. A trailing slash, a www. mismatch, or http:// instead of https:// will produce the infamous "Can't load URL: The domain of this URL isn't included in the app's domains" error.
Then grab your credentials from App Settings → Basic:
- App ID → this becomes your client ID
- App Secret → click Show, re-enter your password, copy it
While you're on that page, fill in Privacy Policy URL, App Icon, and User data deletion (a URL explaining how users can request deletion). Meta requires all three before the app can go live — more on that below.
Step 2: Configure GoTrue Environment Variables
On your server, add the Facebook block to the .env file your Docker Compose stack reads:
# Facebook OAuth GOTRUE_EXTERNAL_FACEBOOK_ENABLED=true GOTRUE_EXTERNAL_FACEBOOK_CLIENT_ID=your-app-id GOTRUE_EXTERNAL_FACEBOOK_SECRET=your-app-secret GOTRUE_EXTERNAL_FACEBOOK_REDIRECT_URI=https://api.yourdomain.com/auth/v1/callback
If your docker-compose.yml doesn't already pass these through to the auth service, add them explicitly:
auth:
environment:
GOTRUE_EXTERNAL_FACEBOOK_ENABLED: ${GOTRUE_EXTERNAL_FACEBOOK_ENABLED}
GOTRUE_EXTERNAL_FACEBOOK_CLIENT_ID: ${GOTRUE_EXTERNAL_FACEBOOK_CLIENT_ID}
GOTRUE_EXTERNAL_FACEBOOK_SECRET: ${GOTRUE_EXTERNAL_FACEBOOK_SECRET}
GOTRUE_EXTERNAL_FACEBOOK_REDIRECT_URI: ${GOTRUE_EXTERNAL_FACEBOOK_REDIRECT_URI}
Then recreate the auth container:
docker compose up -d auth
A plain restart is not enough — Docker only re-reads environment variables when the container is recreated. This single detail accounts for a remarkable share of "I set the variables and nothing changed" threads on GitHub Discussions.
Verify the provider is active:
curl -s https://api.yourdomain.com/auth/v1/settings | jq '.external.facebook' # should print: true
Also double-check your GOTRUE_SITE_URL and GOTRUE_URI_ALLOW_LIST — after Facebook hands the user back to GoTrue, GoTrue redirects to your app, and a wrong Site URL sends every successful login to http://localhost:3000. We've covered that failure mode in depth in our redirect URLs and Site URL configuration guide.
Step 3: Trigger the Login from Your App
Client-side, nothing differs from any other provider:
const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'facebook',
options: {
scopes: 'email public_profile',
redirectTo: 'https://app.yourdomain.com/auth/callback',
},
});
email and public_profile are the two permissions you want. Anything beyond those requires Meta App Review with screencasts and justifications — avoid it unless you genuinely need it.
Step 4: Take the App Live (The Part Everyone Forgets)
New Meta apps start in Development Mode. In development mode, only users with a role on the app (admins, developers, testers) can log in. Everyone else gets "App not active: This app is not accessible right now."
This is the most common "it works for me but not for my users" report with Facebook auth. To go live:
- Complete Privacy Policy URL, App Icon, and Data Deletion in App Settings → Basic
- Flip the App Mode toggle from Development to Live
For standard access to email and public_profile, consumer apps generally do not need full App Review — but Meta may require Business Verification if your app is linked to a business portfolio. Budget time for this; verification can take days, and it's not something you want to discover during a launch.
Honest Trade-Offs: Should You Even Offer Facebook Login?
A few things worth knowing before you commit:
- Facebook accounts don't always have an email. Users who registered with a phone number can return a profile with no email address, and GoTrue will reject the sign-in or create a user you can't contact. Offer magic links or another provider as a fallback, and consider identity linking so users who signed up with email can attach Facebook later instead of creating duplicate accounts.
- The consent screen shows your API domain. Just like with Google, users see the domain hosting GoTrue, not your brand, unless your API lives on your own domain. The mechanics (and workarounds) are the same ones we documented for fixing Google OAuth branding.
- Meta policy churn is real. Redirect URI rules, permission tiers, and review requirements change more often than any other major provider. When login breaks after months of working fine, check Meta's changelog before touching your stack.
None of this is a reason to skip Facebook Login — for consumer apps it still converts well, particularly on mobile — but it is a reason to keep the configuration somewhere you can audit and change quickly.
Managing OAuth Providers Without Hand-Editing .env Files
The GoTrue side of this guide is four environment variables. The problem is that it's four variables per provider, per project, living in a .env file on a server, applied by recreating containers over SSH. Multiply by Google, GitHub, Apple, Discord, and Facebook across three projects and you have sixty untracked settings and no record of who changed what.
This is exactly the operational gap Supascale closes: it gives self-hosted Supabase instances a provider configuration UI — enter the Facebook App ID and Secret, click save, and Supascale updates the environment and recreates the auth service for you, with the callback URL displayed ready to paste into Meta's console. It's a one-time license with no per-project fees, so managing OAuth across every instance you run costs the same as managing one.
Conclusion
Facebook Login on self-hosted Supabase comes down to four things: an HTTPS callback URL registered exactly in Meta's console, four GOTRUE_EXTERNAL_FACEBOOK_* variables, a recreated auth container, and an app switched from Development to Live mode. The GoTrue half is mechanical; the Meta half — review requirements, missing emails, policy changes — is where the real maintenance lives. Set up a fallback auth method, keep your provider config auditable, and test with a non-admin Facebook account before you announce the feature.
Further Reading
- Setting Up OAuth Providers for Self-Hosted Supabase — the full provider overview
- Redirect URLs and Site URL Configuration for Self-Hosted Supabase — fix post-login redirects to localhost
- Identity Linking for Self-Hosted Supabase — let users connect multiple providers to one account
- Apple Sign-In for Self-Hosted Supabase — required if you offer Facebook Login in an iOS app
- Auth providers documentation
