This guide walks through creating Google OAuth 2.0 credentials so users can log into Genesis with their Google account.
- Go to Google Cloud Console
- Click the project dropdown at the top and select New Project
- Name it (e.g.,
genesis-iam) and click Create - Make sure the new project is selected in the dropdown
- In the left sidebar, go to APIs & Services > OAuth consent screen
- Select External (allows any Google account to log in) and click Create
- Fill in the required fields:
- App name: Your app name (e.g.,
Genesis Auth) - User support email: Your email
- Developer contact information: Your email
- App name: Your app name (e.g.,
- Click Save and Continue
- On the Scopes screen, click Add or Remove Scopes and add:
openidemailprofile
- Click Update, then Save and Continue
- On Test users, add your Google email for testing (only needed while in "Testing" mode)
- Click Save and Continue, then Back to Dashboard
- Go to APIs & Services > Credentials
- Click + Create Credentials > OAuth client ID
- Application type: Web application
- Name:
Genesis IAM(or anything) - Under Authorized redirect URIs, click + Add URI and enter:
For production, add your real domain:
http://localhost:8000/auth/sso/google/callbackhttps://auth.yourdomain.com/auth/sso/google/callback - Click Create
A dialog shows your credentials:
- Client ID:
123456789-abcdef.apps.googleusercontent.com - Client Secret:
GOCSPX-xxxxxxxxxxxxx
Copy both values.
Add to your docker-compose.yml environment section (or .env file):
GOOGLE_CLIENT_ID: "123456789-abcdef.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET: "GOCSPX-xxxxxxxxxxxxx"Restart the API:
docker compose up -d api-
Verify Google is listed:
curl http://localhost:8001/auth/sso/providers # Should include "google" -
Open in your browser:
http://localhost:8001/auth/sso/google/authorize -
You should be redirected to Google's login page
-
After signing in, Google redirects back to Genesis
-
Genesis returns JWT tokens (or redirects to your frontend with tokens)
- Testing mode: While the consent screen is in "Testing" status, only test users you added can log in. To allow any Google account, publish the app (may require Google review).
- Redirect URI must match exactly: The URI in Google Console must match
{OAUTH_ISSUER}/auth/sso/google/callback. IfOAUTH_ISSUERishttp://localhost:8000, the redirect URI must behttp://localhost:8000/auth/sso/google/callback. - Scopes: Genesis requests
openid email profilefrom Google. This returns the user's email, name, and profile picture.
{
"sub": "1234567890",
"email": "user@gmail.com",
"email_verified": true,
"name": "Jane Doe",
"given_name": "Jane",
"family_name": "Doe",
"picture": "https://lh3.googleusercontent.com/..."
}Genesis uses this to create or link the user account and populate the profile.