Guides
Authentication Providers
Setup OAuth providers like Google for user authentication.
1. Create Google OAuth Credentials
Create a Google Cloud Project
- Go to the Google Cloud Console
- Create a new project or select an existing one
Set Up the OAuth Consent Screen
- Navigate to APIs & Services → OAuth consent screen
- Choose External (for public apps) or Internal (for workspace-only apps)
- Fill in app name, support email, and developer contact email
- Skip scopes (defaults are sufficient) and save
Create OAuth 2.0 Credentials
- Go to APIs & Services → Credentials
- Click + CREATE CREDENTIALS → OAuth client ID
- Choose Web application
- Add Authorized JavaScript origins:
- Development:
http://localhost:3000 - Production:
https://yourdomain.com
- Development:
- Add Authorized redirect URIs:
- Development:
http://localhost:3000/api/auth/callback/google - Production:
https://yourdomain.com/api/auth/callback/google
- Development:
- Click Create and copy the Client ID and Client Secret
2. Configure Environment Variables
Add the following to your .env.local:
VITE_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret3. Test It
- Start the dev server:
pnpm dev - Navigate to
http://localhost:3000/auth/sign-in - You should see a "Sign in with Google" button
- Click it and complete the OAuth flow
Production Checklist
- Add your production domain to authorized origins and redirect URIs in Google Cloud Console
- Set
VITE_GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETin your hosting platform's environment variables - Publish your OAuth consent screen to remove the "unverified app" warning and the 100-user limit
- Optionally, verify your domain in Google Search Console for improved trust
Troubleshooting
- "Redirect URI mismatch": Make sure the redirect URI in Google Cloud Console exactly matches
/api/auth/callback/google(no trailing slash). - "This app isn't verified": This is normal during development. Click Advanced → Go to app (unsafe) to proceed, or publish your consent screen for production.
- No Google button on sign-in page: Check that both
VITE_GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETare set. A console warning will appear if they're missing.