Set up per workspace, on a paid plan
Your Google OAuth client ID identifies your app to Google. Register it in the workspace's Tenant Settings → SSO (choose Google). nostackai accepts a Google sign-in only when the token was issued to a client ID one of your org's workspaces registered, so a token Google issued to some other app is refused.
Get a Google OAuth client ID
Register it in nostackai
The two ways a user signs in with Google
- Plain Google account (a personal gmail.com or googlemail.com address) — your app starts Google sign-in with the client ID it was configured with, then sends the Google ID token to the token endpoint. No lookup is needed. If a workspace registered that client ID under Personal Google accounts (Gmail), the person joins that workspace; otherwise they follow your org's usual rule for new users (the default workspace, or none until they join one in a multi-workspace org).
- Company email (Google Workspace) — your app asks for the work email and calls
POST /app/{orgCode}/ssoconfigwithclient_idin the header and{ "email": "..." }in the body. The email's domain finds the workspace and the answer is{ "provider": "google", "client_id": "..." }. Your app then starts Google sign-in with that client ID (Google's own button, no redirect).
Either way the Google ID token goes to the same endpoint:
GET /app/{orgCode}/token
oauthtoken: <google id_token>
client_id: <your app client id>
-> 200, header x-nostackai-token: <app JWT> What is verified
The token's signature is checked against Google's published keys and the email must be verified by Google. The email's domain decides the client ID: a domain a workspace claimed must use that workspace's client ID, a gmail.com or googlemail.com address must use a client ID a workspace of your org registered, and any other domain is refused. An org with no workspace that registered a Google client ID cannot sign in with Google.
How the user record is created
There's no separate sign-up step. The first time a given Google account calls the token endpoint, nostackai reads the email, name and picture off the ID token and creates the account inline, skipping only the password. Later sign-ins resolve to the same record.
- Single-tenancy org — the new account joins the org's one workspace and is immediately usable.
- Multi-tenancy org, first sign-in — the account is created but has no workspace. Your app prompts the user to create or join one before anything workspace-scoped works — see App user authentication.