DocsPlatform
Single sign-on (OIDC)
Let an organization's members sign in through their OpenID Connect identity provider, with just-in-time provisioning and optional enforcement.
Tested against an in-test identity provider only. The OIDC flow (discovery, PKCE, ID token verification, just-in-time provisioning, enforcement) is exercised by automated tests that run against a small OpenID provider built for the tests, with generated RSA and P-256 keys. It has not been tried with Okta, Microsoft Entra ID, Google Workspace or any other real provider. Expect to debug provider-specific details the first time.
Each organization can configure one OpenID Connect provider. Members then sign in with it instead of a password. Setup is for admins and owners, in the dashboard under Security, or through the SSO API.
Set it up
- In your identity provider, register a web application using the authorization code flow. Set its redirect URI to the value Generic Translation shows as
redirectUri. On the hosted instance that ishttps://generic-translation-api.jacobfv123.workers.dev/v1/auth/sso/callback. Copy the client id and client secret. - In Generic Translation, enter:
issuer: the provider’s issuer URL. It must behttps, with no query or fragment. Generic Translation reads<issuer>/.well-known/openid-configuration.clientIdandclientSecret. The secret is optional (public PKCE clients have none).domains: the email domains that belong to your organization, such asacme.dev.defaultRole:viewer,member(the default) oradmin, given to people who sign in for the first time.enforce: off until you have tested the login.
- Test by signing in from an incognito window before turning on
enforce.
The client secret is write-only. Generic Translation stores it encrypted (AES-256-GCM, with a key derived from the instance’s ENCRYPTION_KEY secret) and never returns it; reads only report hasClientSecret. Leaving it out when you update keeps the stored one. If the instance has no ENCRYPTION_KEY, storing a secret fails with 501 sso_not_configured.
Domain rules
- A domain can belong to one organization only; claiming a taken one returns
409 conflict. - Public mail providers (gmail.com, outlook.com, yahoo.com, icloud.com and similar) are rejected.
- Domains are not verified through DNS. Generic Translation does not check that you own them. That is why enforcement is limited as described below.
How a sign-in works
- The dashboard asks
GET /v1/auth/sso/discover?email=…whether the email’s domain has SSO, and if so sends the browser toGET /v1/auth/sso/start?orgId=…. - Generic Translation stores a one-time state, nonce and PKCE verifier (10 minutes) and redirects to the provider’s authorization endpoint with scope
openid email profile. - The provider redirects back to the callback with a code. Generic Translation exchanges it (using client secret basic auth, secret in the body, or no secret, depending on what the provider supports) and verifies the ID token against the provider’s keys: signature (RS256 or ES256), issuer, audience, expiry, issued-at and nonce.
- The token’s email must be present, must not be marked unverified, and its domain must be one of the organization’s
domains. - Generic Translation finds the user by email or creates one, adds them to the organization with
defaultRoleif they are not a member yet, and creates a session. The browser lands on the dashboard with the session token in the URL fragment.
Just-in-time provisioning: an unknown email gets an account on first sign-in. Its password is random and never shown, so that account can only sign in through SSO until someone sets a password. Existing members keep their current role; defaultRole applies only when the membership is created.
If something fails, the browser returns to the dashboard with an error code: invalid_request, invalid_state (expired or reused attempt), idp_error, token_exchange_failed, invalid_id_token, email_not_verified, email_domain_mismatch or sso_not_configured.
Enforcement
With enforce on, password login (POST /v1/auth/login) answers 403 sso_required for a user who is a member of that organization and whose email domain is one of its domains. The error includes the organization id.
That is the whole rule, and it is narrower than it might sound:
- It does not stop anyone signing in with a password if they are not a member, or their email domain is not listed. Because domains are not DNS-verified, an organization cannot lock out strangers.
- It does not affect API keys.
- It does not remove existing sessions. Sessions already issued stay valid until they expire or are revoked.
- Deactivating someone in your provider does not by itself end their Generic Translation access. Use SCIM for that.
Audit log
sso.updated, sso.deleted, sso.login and member.added (with via: "sso") are written to the audit log.
Something wrong or unclear on this page? Open an issue.