Introduction
Components
- Accordion
- Action Sheet
- Alert
- Alert Dialog
- Audio Player
- Audio Recorder
- Audio Waveform
- Avatar
- AvoidKeyboard
- Badge
- BottomSheet
- Button
- Camera
- Camera Preview
- Card
- Carousel
- Checkbox
- Collapsible
- Color Picker
- Combobox
- Date Picker
- File Picker
- Gallery
- Hello Wave
- Icon
- Image
- Input
- Input OTP
- Link
- MediaPicker
- Mode Toggle
- Onboarding
- ParallaxScrollView
- Picker
- Popover
- Progress
- Radio
- ScrollView
- SearchBar
- Separator
- Share
- Sheet
- Skeleton
- Spinner
- Switch
- Table
- Tabs
- Text
- Toast
- Toggle
- Video
- View
Charts
Overview
This guide will walk you through setting up Google OAuth authentication for your Convex application. By the end of this setup, your users will be able to sign in using their Google accounts.
Prerequisites
Before starting, ensure you have:
- A Google developer account (create one at Google for Developers)
- A Convex project set up and deployed
- Access to your Convex deployment's HTTP Actions URL
Step 1: Create or Open a Google Cloud Project
- Navigate to the Google Auth Platform overview
- Select an existing project or create a new one by clicking "New Project"
- If creating a new project, provide a project name and click "Create"





Step 2: Configure OAuth Consent Screen
Initial Setup
- In your Google Cloud Console, navigate to APIs & Services > OAuth consent screen
- Click the "GET STARTED" button on the Overview page
- Fill in the required information:
- App name: Enter the name that will be displayed to users during authentication
- User support email: Select an email address for user support
- Click "NEXT"




Choose App Type
- Select your app type:
- Internal: For apps used within your organization only
- External: For public applications (recommended for most use cases)
- Click "NEXT"

Contact Information
- Enter email addresses for Contact Information (required for external apps)
- Click "NEXT"
- Review the User Data Policy and check the agreement box
- Click "CONTINUE"
- Click "CREATE"


Configure Test Users (External Apps Only)
If you chose External app type:
- Click "Test users" in the left navigation menu
- Click "ADD USERS"
- Add email addresses of users who should be able to test your authentication
- Click "SAVE"
Step 3: Create OAuth Client Credentials
Create OAuth Client
- Navigate to APIs & Services > Credentials
- Click "CREATE CREDENTIALS" and select "OAuth client ID"
- Choose "Web application" as the application type
- Enter a name for your OAuth client (for organizational purposes only)



Configure Authorized Origins and Redirect URIs
Authorized JavaScript Origins
For development:
http://localhost:3000
For production, add your actual domain:
https://yourdomain.com
Authorized Redirect URIs
-
Find your Convex HTTP Actions URL:
- Open your Convex dashboard
- Navigate to Settings > URL & Deploy Key > Show development credentials
- Note your HTTP Actions URL (ends with
.site
, not.cloud
)
-
Configure the redirect URI:
- Format:
{HTTP_ACTIONS_URL}/api/auth/callback/google
- Example: If your actions URL is
https://fast-horse-123.convex.site
, then your redirect URI is:
https://fast-horse-123.convex.site/api/auth/callback/google
- Format:
-
Click "CREATE" to save your OAuth client


Step 4: Set Convex Environment Variables
Retrieve OAuth Credentials
- From the Credentials page, click on your newly created OAuth client
- Copy the Client ID and Client secret values


Configure Environment Variables
You can set environment variables either via the Convex CLI or through the dashboard.
Option 1: Using Convex CLI (Recommended)
Open your terminal in your Convex application directory and run:
# Set Google OAuth Client ID
npx convex env set AUTH_GOOGLE_ID your_google_client_id_here
# Set Google OAuth Client Secret
npx convex env set AUTH_GOOGLE_SECRET your_google_client_secret_here
Option 2: Using Convex Dashboard
- Open your Convex dashboard
- Navigate to Settings > Environment Variables
- Add the following variables:
- Variable Name:
AUTH_GOOGLE_ID
, Value: Your Google Client ID - Variable Name:
AUTH_GOOGLE_SECRET
, Value: Your Google Client Secret
- Variable Name:

Common Issues and Solutions
"Error 400: redirect_uri_mismatch"
- Verify your redirect URI exactly matches the format:
{HTTP_ACTIONS_URL}/api/auth/callback/google
- Ensure you're using the correct HTTP Actions URL (ends with
.site
)
Environment Variables Not Found
- Ensure environment variables are set correctly
- Restart your Convex deployment after setting new environment variables
Security Best Practices
- Regularly rotate your OAuth client secrets
- Monitor your Google Cloud Console for any suspicious activity
- Use HTTPS in production environments
- Consider implementing additional security measures like rate limiting
Support
For additional help:
Secure authentication made simple with Convex Auth! 🚀
On This Page
OverviewPrerequisitesStep 1: Create or Open a Google Cloud ProjectStep 2: Configure OAuth Consent ScreenInitial SetupChoose App TypeContact InformationConfigure Test Users (External Apps Only)Step 3: Create OAuth Client CredentialsCreate OAuth ClientConfigure Authorized Origins and Redirect URIsAuthorized JavaScript OriginsAuthorized Redirect URIsStep 4: Set Convex Environment VariablesRetrieve OAuth CredentialsConfigure Environment VariablesOption 1: Using Convex CLI (Recommended)Option 2: Using Convex DashboardCommon Issues and Solutions"Error 400: redirect_uri_mismatch"Environment Variables Not FoundSecurity Best PracticesSupport