SSO Setup (`seed-sso.py` + Google Cloud)
Getting Google SSO working is two parts: (1) a Google OAuth client in Google
Getting Google SSO working is two parts: (1) a Google OAuth client in Google
Cloud Console, and (2) running scripts/seed-sso.py to wire that client into
Liquid IAM as the domain-gated Google provider on the single-SSO application.
1. Google Cloud Console (external)
In Google Cloud Console -> your project -> OAuth:
- Configure the OAuth consent screen (Internal, if the org is the Google
Workspace
satschel.com, so only org users can consent). - Create an OAuth 2.0 Client ID of type Web application.
- Authorized JavaScript origins = the IAM origin(s):
http://localhost:8000(local)https://iam.example.com(hosted)
- Authorized redirect URIs = the IAM callback (IAM's, not the app's):
http://localhost:8000/callbackhttps://iam.example.com/callback
- Copy the Client ID and Client secret for the seed script (env only, never committed).
The redirect URI points at IAM's
/callbackbecause Google returns to IAM; IAM then returns to the relying app's/callback.
2. scripts/seed-sso.py
Idempotent script that authenticates as admin, creates/updates the Google
provider with a domain-restricted emailRegex, and configures the target
application for single-SSO (Google only, password login off, only Logo +
Providers shown on the login page). It retries on SQLITE_BUSY.
Environment variables
| Var | Purpose | Default |
|---|---|---|
IAM_URL | IAM base URL | http://localhost:8000 |
IAM_ADMIN_USER / IAM_ADMIN_PASS | admin login | admin / 123 |
IAM_ADMIN_ORG / IAM_ADMIN_APP | admin realm/app for login | built-in / app-built-in |
GOOGLE_CLIENT_ID | from Google Cloud Console | (required) |
GOOGLE_CLIENT_SECRET | from Google Cloud Console | (required) |
ALLOWED_DOMAIN | email domain to gate | satschel.com |
APP_ORG | organization | liquidity |
APP_NAME | application to configure | transfer-agent |
PROVIDER_NAME | provider name | google-<domain-prefix> (e.g. google-satschel) |
IAM_LOGO | login logo URL | {IAM_URL}/liquidity-logo.svg |
Run
export IAM_URL=http://localhost:8000
export GOOGLE_CLIENT_ID=xxxxx.apps.googleusercontent.com
export GOOGLE_CLIENT_SECRET=xxxxx
export ALLOWED_DOMAIN=satschel.com
export APP_ORG=liquidity
export APP_NAME=transfer-agent
python3 scripts/seed-sso.pyWhat it configures
- Provider
admin/google-satschel:type=Google, scopesprofile email,emailRegex = ^[a-zA-Z0-9._%+-]+@satschel\.com$. - Application
transfer-agent(orgliquidity):enablePassword=false,enableSignUp=true(JIT), Google provider linked (canSignUp/canSignIn), only Logo + Providers visible on the login page, Liquidity CSS/footer applied.
3. Relying-party redirect URIs (in the IAM app)
For each app that logs in through IAM, its redirectUris must include every
console origin's /callback, and its post-logout URIs must include each origin
root. For the Transfer Agent console, that means entries like:
http://localhost:5173/callbackandhttp://localhost:5173https://app.example.com/callbackandhttps://app.example.com
These are set on the Application (admin console or via the seed/admin API).
Checklist summary
- Google OAuth client created; JS origins + redirect URIs include the IAM origin/
callback -
GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRETprovided toseed-sso.pyvia env -
seed-sso.pyrun against the target IAM - App
redirectUrisinclude the relying app's/callback(+ post-logout roots) - Admin password changed for any shared instance