Skip to main content
This guide walks you through configuring Google OAuth for your app’s authentication. Your app’s users will be able to sign in with their Google accounts.

Prerequisites

  • A published Replit app (you need a deployment URL like your-app.replit.app)
  • Access to the Google Cloud Console

Step 1: Publish your app

Before configuring custom OAuth credentials, you need a published deployment URL. You’ll need the URL when setting up your custom Google credentials.
  1. Publish your app from the Replit workspace
  2. Note your published URL (e.g., https://your-app.replit.app)

Step 2: Create a Google OAuth app

Navigate to the Google Cloud Console:

Create or select a project

  1. Select an existing project or create a new one from the project dropdown
  2. You’ll be redirected to your project’s Dashboard
  1. In the left sidebar, select the menu icon (≡) and select APIs & Services
  2. Select OAuth consent screen
  3. Configure your app’s consent screen with required information
  4. Save your changes

Create OAuth credentials

  1. From APIs & Services, select Credentials
  2. Select Create Credentials at the top, then select OAuth client ID
  3. Choose Web application as the application type
  4. Configure the following:
Authorized JavaScript origins: Add your published app URL:
https://your-app.replit.app
If you have a custom domain, add that as well:
https://your-custom-domain.com
Authorized redirect URIs: The redirect URI is your published domain followed by /__clerk/v1/oauth_callback. Add the following, replacing your-app.replit.app with your actual published domain:
https://your-app.replit.app/__clerk/v1/oauth_callback
If you have a custom domain:
https://your-custom-domain.com/__clerk/v1/oauth_callback
  1. Select Create
  2. Save your Client ID and Client Secret
Keep your Client Secret secure and never commit it to version control.

Step 3: Enter credentials in Replit

  1. In your Repl, navigate to the Auth pane
  2. Select the Configure tab
  3. Select Production environment
  4. Select the Edit button next to Google
  5. Toggle on Use custom credentials
  6. Paste your Client ID and Client Secret
  7. Select Save changes
  8. Toggle Google to Enabled

Step 4: Test your integration

  1. Open your published app’s login page
  2. Select Sign in with Google
  3. Complete the Google sign-in flow
  4. Verify successful authentication
Google sign-in does not work in embedded browsers or in-app webviews. Users must use a standard web browser.

Troubleshooting

Redirect URI mismatch

  • Verify the redirect URI in Google Cloud Console is exactly https://your-app.replit.app/__clerk/v1/oauth_callback
  • Ensure there are no trailing slashes or typos
  • Wait a few minutes for Google’s configuration to propagate

Invalid client

  • Double-check Client ID and Client Secret are copied correctly
  • Ensure there are no extra spaces
  • Verify OAuth consent screen is configured

Not working on custom domain

  • Add your custom domain to both Authorized JavaScript origins and Authorized redirect URIs
  • Use the format https://your-custom-domain.com/__clerk/v1/oauth_callback for the redirect URI
  • Republish your app and clear browser cache