This guide walks you through configuring GitHub OAuth for your app’s authentication. Your app’s users will be able to sign in with their GitHub accounts.
Prerequisites
- A published Replit app (you need a deployment URL like
your-app.replit.app)
- A GitHub account
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 GitHub credentials.
- Publish your app from the Replit workspace
- Note your published URL (e.g.,
https://your-app.replit.app)
Step 2: Create a GitHub OAuth app
- Navigate to GitHub Developer Settings
- Select OAuth Apps in sidebar
- Select New OAuth App
- Fill in the application details:
Application name:
Enter a name for your application.
Homepage URL:
Enter your published app URL:
https://your-app.replit.app
Authorization callback URL:
The callback URL is your published domain followed by /__clerk/v1/oauth_callback. Enter the following, replacing your-app.replit.app with your actual published domain:
https://your-app.replit.app/__clerk/v1/oauth_callback
- Select Register application
Step 3: Generate client credentials
- You’ll see your Client ID on the app’s settings page - copy it
- Select Generate a new client secret
- Copy your Client Secret immediately
Save your Client Secret securely. You can’t view it again after leaving the page. If lost, you’ll need to generate a new one.
Step 4: Enter credentials in Replit
- In your Repl, navigate to the Auth pane
- Select the Configure tab
- Select Production environment
- Select the Edit button next to GitHub
- Toggle on Use custom credentials
- Paste your Client ID and Client Secret
- Select Save changes
- Toggle GitHub to Enabled
Step 5: Test your integration
- Open your published app’s login page
- Select Sign in with GitHub
- Authorize the app on GitHub
- Verify successful authentication
Troubleshooting
Redirect URI mismatch
- Verify the Authorization callback URL is exactly
https://your-app.replit.app/__clerk/v1/oauth_callback
- Check for typos or incorrect protocols
- No trailing slashes
Invalid client
- Double-check Client ID and Client Secret are copied correctly
- Ensure no extra spaces when pasting
Not working on custom domain
- Update the Homepage URL in your GitHub OAuth app to your custom domain
- Update the Authorization callback URL to
https://your-custom-domain.com/__clerk/v1/oauth_callback
- Republish your app