Google OAuth
Google Sign-In lets users authenticate with their Google account. It’s widely trusted and many users prefer it for its convenience.Overview
Setting up Google OAuth requires configuration in three places:- Google Cloud Console — Create OAuth credentials
- Supabase Dashboard — Enable Google as an auth provider
- Your App — Configure the redirect URI and use the auth function
Part 1: Google Cloud Console
Step 1: Create a Project (if needed)
Open Google Cloud Console
Go to console.cloud.google.comSign in with your Google account
Step 2: Configure OAuth Consent Screen
Before creating credentials, you need to configure what users see when they sign in.Open OAuth consent screen
Go to APIs & Services → OAuth consent screenDirect link
Select user type
Choose External (unless you’re building for a Google Workspace organization)Click Create
Fill in app information
| Field | Value |
|---|---|
| App name | Your app’s name |
| User support email | Your email |
| App logo | Optional, but recommended |
| Developer contact email | Your email |
Scopes
Click Add or Remove ScopesSelect:
.../auth/userinfo.email.../auth/userinfo.profileopenid
Step 3: Create OAuth Credentials
Open Credentials
Go to APIs & Services → CredentialsDirect link
Configure for iOS
| Field | Value |
|---|---|
| Application type | iOS |
| Name | Your App (iOS) |
| Bundle ID | Your app’s bundle ID (e.g., com.yourcompany.yourapp) |
Save your Client ID
Copy the Client ID — you’ll need this for SupabaseIt looks like:
123456789-abc123def456.apps.googleusercontent.comPart 2: Supabase Dashboard
Enable Google Provider
Enter credentials
Use the Web application credentials (not iOS):
| Field | Value |
|---|---|
| Client ID | Your Web OAuth Client ID |
| Client Secret | Your Web OAuth Client Secret |
Part 3: App Configuration
Step 1: Update App Config
Updateconfig/app.config.ts:
Step 2: Configure Redirect URI
Inlib/auth.ts, update the scheme in signInWithGoogle() to match your app:
app.json:
Step 3: Use in Your App
Testing
Development Build Required
Google OAuth requires a development build — it won’t work in Expo Go.Testing Checklist
- Build and install the development build
- Tap “Sign in with Google”
- Browser opens with Google’s sign-in page
- Sign in with a test user account
- You’re redirected back to the app
- User is authenticated
Troubleshooting
'redirect_uri_mismatch' error
'redirect_uri_mismatch' error
The redirect URI in Google Console must exactly match what your app sends.
- Check the redirect URI in Credentials → Web client → Authorized redirect URIs
- It should be:
https://YOUR_PROJECT_REF.supabase.co/auth/v1/callback - No trailing slash, exact case match
'access_denied' error
'access_denied' error
- If using External user type, ensure your Google account is added as a test user
- Or publish your OAuth consent screen to production
Browser opens but nothing happens
Browser opens but nothing happens
- Check your app scheme matches in
app.jsonand the auth code - Ensure you’re using a development build, not Expo Go
'invalid_client' error
'invalid_client' error
- Verify you’re using the Web client credentials in Supabase (not iOS)
- Double-check the Client ID and Client Secret are correct
Publishing to Production
Before launching your app:Publish OAuth consent screen
Go to OAuth consent screen in Google Cloud ConsoleClick Publish AppThis removes the “test user” restriction