Codapult supports six OAuth providers via Better-Auth. Enable any provider by adding its credentials to .env.local and listing it in appConfig.auth.oauthProviders.
Quick Setup
- Add the provider to
src/config/app.ts:
auth: {
oauthProviders: ['google', 'github', 'apple'],
},
- Set the corresponding env vars in
.env.local(see table below) - Set the callback URL in the provider's developer console:
https://your-app.com/api/auth/callback/<provider>
Provider Reference
| Provider | Client ID Env Var | Client Secret Env Var | Console URL |
|---|---|---|---|
GOOGLE_CLIENT_ID | GOOGLE_CLIENT_SECRET | Google Cloud Console | |
| GitHub | GITHUB_CLIENT_ID | GITHUB_CLIENT_SECRET | GitHub Developer Settings |
| Apple | APPLE_CLIENT_ID | APPLE_CLIENT_SECRET | Apple Developer |
| Discord | DISCORD_CLIENT_ID | DISCORD_CLIENT_SECRET | Discord Developer Portal |
TWITTER_CLIENT_ID | TWITTER_CLIENT_SECRET | Twitter Developer Portal | |
| Microsoft | MICROSOFT_CLIENT_ID | MICROSOFT_CLIENT_SECRET | Azure App Registrations |
Callback URLs
Every provider needs a callback URL registered in its console. The format is always:
https://your-app.com/api/auth/callback/<provider>
For local development, use http://localhost:3000/api/auth/callback/<provider>.
Google Setup
- Go to the Google Cloud Console → Credentials
- Create an OAuth 2.0 Client ID (type: Web application)
- Add authorized redirect URI:
https://your-app.com/api/auth/callback/google - Copy credentials to
.env.local:
GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="GOCSPX-your-secret"
GitHub Setup
- Go to GitHub → Settings → Developer settings → OAuth Apps
- Create a new OAuth App
- Set callback URL:
https://your-app.com/api/auth/callback/github - Copy credentials to
.env.local:
GITHUB_CLIENT_ID="your-client-id"
GITHUB_CLIENT_SECRET="your-client-secret"
Other Providers
Apple, Discord, Twitter, and Microsoft follow the same pattern:
- Create an OAuth application in the provider's developer console (see links in the table above)
- Set the callback URL to
https://your-app.com/api/auth/callback/<provider> - Copy the client ID and secret to
.env.localusing the env var names from the table - Add the provider name to
oauthProvidersinsrc/config/app.ts
For provider-specific setup details (Apple certificates, Microsoft tenant config, etc.), see the Better-Auth OAuth documentation.
Disabling OAuth
Remove the provider from the oauthProviders array in src/config/app.ts. The sign-in page automatically hides the removed provider's button.