Overview
This guide walks you through configuring Google OAuth as the authentication provider for your subscription application. Users will be able to sign in using their Google accounts.Prerequisites
- A Supabase project (see Supabase Setup)
- A Google Cloud Console account
Configure Google Cloud Console
Create or select a Google Cloud project
Go to Google Cloud Console and either:
- Create a new project by clicking Select a project → New Project
- Select an existing project from the dropdown
Enable Google+ API
In your Google Cloud project:
- Navigate to APIs & Services → Library
- Search for “Google+ API”
- Click on it and press Enable
The Google+ API is required for OAuth authentication even though Google+ as a social network is deprecated.
Configure OAuth consent screen
Navigate to APIs & Services → OAuth consent screen.
- Select External as the user type (unless you’re using Google Workspace)
- Fill in the required application information:
- App name: Your application name
- User support email: Your support email
- Developer contact information: Your email address
- Click Save and Continue
- Skip the “Scopes” section by clicking Save and Continue
- Add test users if your app is in testing mode
- Click Save and Continue to finish
Create OAuth 2.0 credentials
Navigate to APIs & Services → Credentials.
- Click Create Credentials → OAuth 2.0 Client IDs
- Select Web application as the application type
- Add a name for your OAuth client
-
Under Authorized redirect URIs, add:
Replace
[your-project-ref]with your actual Supabase project reference. - Click Create
- Copy the Client ID and Client Secret from the popup
Configure Supabase Authentication
Navigate to Authentication settings
In your Supabase project dashboard, go to Authentication → Providers.
Enable Google provider
- Find Google in the list of providers
- Toggle the Enable switch
- Enter the Client ID from Google Cloud Console
- Enter the Client Secret from Google Cloud Console
- Click Save
Test Authentication
Once you’ve deployed your application, you can test the Google OAuth flow:- Navigate to your application’s sign-in page
- Click the “Sign in with Google” button
- You should be redirected to Google’s OAuth consent screen
- After granting permissions, you’ll be redirected back to your application
If your Google Cloud project is in testing mode, only users you’ve added as test users will be able to sign in.
Common Issues
Redirect URI mismatch error
Redirect URI mismatch error
This error occurs when the redirect URI in your Google Cloud Console doesn’t exactly match the one used by Supabase.Solution: Double-check that you’ve added the exact redirect URI:Make sure there are no trailing slashes or typos.
Access blocked: This app's request is invalid
Access blocked: This app's request is invalid
This usually happens when the OAuth consent screen is not properly configured.Solution: Go back to the OAuth consent screen in Google Cloud Console and ensure all required fields are filled in correctly.
Only test users can sign in
Only test users can sign in
If your app is in testing mode, only users explicitly added as test users can authenticate.Solution: Either add users as test users in the OAuth consent screen, or publish your app to production (requires verification for certain scopes).
Next Steps
Dodo Payments
Set up your Dodo Payments account for subscription management
Database Setup
Configure your database schema
