Google OAuth Setup Guide
Synced from the TurfAI source on 2026-06-21.
Quick guide to set up Google Cloud OAuth credentials for TurfAI.
Step 1: Create Google Cloud Project (if needed)
- Go to Google Cloud Console
- Click "Select a Project" → "New Project"
- Name:
TurfAI(or use existing project) - Click "Create"
Step 2: Enable Required APIs
- Go to APIs & Services → Library
- Search and enable:
- Google+ API
- People API
Step 3: Configure OAuth Consent Screen
-
Go to APIs & Services → OAuth consent screen
-
Choose External (for testing) or Internal (for organization only)
-
Fill in Application Information:
- App name:
TurfAI - User support email: Your email
- Developer contact: Your email
- App name:
-
Click Save and Continue
-
Scopes (Step 2):
- Click Add or Remove Scopes
- Select:
.../auth/userinfo.email.../auth/userinfo.profileopenid
- Click Update → Save and Continue
-
Test users (Step 3) - Add your email for testing
-
Click Save and Continue
-
Review and click Back to Dashboard
Step 4: Create OAuth 2.0 Client ID
-
Go to APIs & Services → Credentials
-
Click + CREATE CREDENTIALS → OAuth 2.0 Client ID
-
Choose Application type: Web application
-
Name:
TurfAI Web Client -
Authorized JavaScript origins:
http://localhost:1337 http://localhost:3000 -
Authorized redirect URIs:
http://localhost:1337/api/connect/google/callback http://localhost:3000/auth/callback -
Click Create
-
IMPORTANT: Copy the credentials:
- Client ID:
1234567890-abcdefg.apps.googleusercontent.com - Client Secret:
GOCSPX-abc123def456
- Client ID:
Step 5: Update Environment Variables
- Open
/dms/.env - Update the Google OAuth values:
GOOGLE_OAUTH_CLIENT_ID=YOUR_ACTUAL_CLIENT_ID.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=GOCSPX-YOUR_ACTUAL_CLIENT_SECRET- Save the file
Step 6: Test OAuth Flow
-
Start DMS:
cd dms npm run develop -
Visit OAuth initiation URL:
http://localhost:1337/api/connect/google -
You should be redirected to Google consent screen
-
After authorizing, you'll be redirected back to TurfAI
Production Setup (Later)
For production deployment, add these redirect URIs to Google Cloud:
https://turfai-dms-eatorcypia-uc.a.run.app/api/connect/google/callback
https://turfai.io/auth/callbackAnd update production .env:
GOOGLE_OAUTH_REDIRECT_URI=https://turfai-dms-eatorcypia-uc.a.run.app/api/connect/google/callback
FRONTEND_URL=https://turfai.ioTroubleshooting
Error: redirect_uri_mismatch
Cause: The redirect URI doesn't match what's registered in Google Console.
Fix:
- Check Google Console → Credentials → Your OAuth Client
- Ensure exact match (including http/https, port, path)
- Add the exact URL from the error message
Error: invalid_client
Cause: Wrong Client ID or Client Secret.
Fix:
- Double-check values in
.env - Ensure no extra spaces or quotes
- Regenerate credentials if needed
Error: Access blocked
Cause: OAuth consent screen not verified or user not in test users list.
Fix:
- Go to OAuth consent screen
- Add your email to test users
- Retry OAuth flow
Next Steps
After Google OAuth is configured:
- ✅ Implement bot prevention middleware
- ✅ Test OAuth signup/login flow
- ✅ Create custom OAuth callback handler (for bot prevention)
- ✅ Deploy to production
Last Updated: 2025-11-08