Status: built (2026-10-05): verified domains, SAML 2.0 and OpenID Connect connections, home-realm discovery, JIT provisioning, "require SSO", and the Admin Portal. Tests: apps/auth-broker/tests/sso.test.ts (31, with a fake SAML identity provider that signs real responses and a fake OIDC one). Not built: SCIM directory sync, IdP-initiated sign-in, SAML single logout, signed AuthnRequests (ENTERPRISE.md has the plan).
A B2B product's enterprise customers want "log in with our Okta". WorkOS sells this per connection ($125/month each); Passkin includes it, and does it so that a customer's IT admin sets it up alone, from a link, without a call.
The three rules that make it safe
- Only a domain the organization has proved routes people to its identity provider. An organization adds a domain and
proves control with a DNS TXT record (
_passkin-challenge.<domain>=passkin-verification=<token>, a random token per organization and domain, so copying another's record proves nothing). A domain is verified for one organization per project; public mailbox providers (gmail.com, outlook.com…) cannot be claimed. - Only an address on that organization's verified domains is believed from its identity provider. An IdP — hostile,
compromised or merely misconfigured — can say anything. If it asserts
ceo@gmail.com, or an address on another organization's domain, the sign-in is refused and the reason is shown to the admin on the connection. (This is the Microsoft "nOAuth" class of takeover, closed by construction for every identity provider.) - A SAML response must be signed by the certificate on file, answer a request Passkin itself sent, and is spent when used.
So only service-provider-initiated sign-in is accepted (IdP-initiated responses carry no
InResponseToand are refused), and a captured response cannot be replayed. Beyond the library's checks (signature, audience, validity window, request id) Passkin verifies the issuer, the recipient and the status itself — the library does not for a login — and these have tests.
What an SSO sign-in is — and is not
- It signs the person in to the product, in their organization —
amr: ["sso"],org_id/org_rolein the tokens, the organization's default role if they are new there (provisioning, on by default). No consent screen: the organization's admin decided. - It does not sign them in to Passkin. No Passkin session cookie is started, so an employer's identity provider cannot be turned into a way into the person's other products through Passkin's own single sign-on. The identity provider's own session makes the next sign-in seamless anyway.
- It respects the project's rules — a closed project (invitation-only, waitlist) still applies; bans, address lists too.
- The account is a normal Passkin passport for that address (an existing one with the same verified address is used) with an
ssoidentity added.
For the developer
Everything is on the Backend API (/v1/…, secret key) and the dashboard's Management API (/v1/manage/projects/:pid/…):
GET|POST /organizations/:oid/domains · POST …/domains/:id/verify · DELETE …/domains/:id |
add a domain (returns the DNS record to make), check it now |
GET|POST /organizations/:oid/sso-connections · GET|PATCH|DELETE …/:cid · POST …/:cid/activate|deactivate |
{protocol: "saml"|"oidc", name, …}; enforce, jit, default_role, attribute_mapping |
GET /sso-connections |
every connection of the project |
POST /organizations/:oid/portal-links |
{intent: "sso"|"domains", return_url?, expires_in_minutes?} → {url} for the customer's IT admin |
SAML: give metadata_url or metadata_xml (parsed: no DTDs, size-capped, https sign-in address, a signing certificate required), or
idp_entity_id + idp_sso_url + idp_certificate. OIDC: issuer, client_id, client_secret (encrypted at rest), optional scopes;
Passkin reads the issuer's discovery document (which must name that issuer) and verifies ID tokens with its published keys. The IdP's
addresses are fetched through the guarded fetch (public hosts, https, no redirects, 1 MB cap) — a customer's server never reaches yours.
A connection goes active only when it is fully configured and the organization has a verified domain. The view shows what the
admin gives their IdP: for SAML the Entity ID (<auth>/sso/<id>), ACS URL (…/acs), metadata (…/metadata) and NameID format
(email); for OIDC the redirect URI (<auth>/sso/callback).
How a person reaches it
- On the hosted sign-in page an "SSO" form appears when any organization of the project has an active connection: the person types a work email; if its domain is verified for an organization with an active connection they go to its identity provider, else they are told it is not set up.
- Your application can skip the page:
connection=sso_<id>, orconnection=sso&organization=<slug>, or alogin_hintwhose domain requires SSO, goes straight there. - Require SSO (
enforce: true, only on an active connection): people on the organization's verified domains can no longer sign in to the project any other way — email code, password, passkey, social, "Continue with Passkin" — including silent sign-in from an earlier session; they see "your organization requires single sign-on". Turning the connection off lifts it.
The Admin Portal
POST …/portal-links returns a URL. Send it to the customer's IT admin (an email, a button in your settings page). Opening it once starts
a two-hour session held by a cookie, scoped to that one organization, and the link stops working. The pages (no script, CSRF-protected,
this-origin only) walk the admin through: 1. domains — add, see the DNS record, check; 2. the identity provider — paste metadata or
enter OIDC details; what to give the IdP; attribute mapping, the role for newly provisioned people, provisioning on/off; 3. a test that
signs in through the IdP and shows what it sent and whether it would be accepted (nothing is changed and nobody is signed in), 4. turn it
on, and require it. Everything the admin does is written to your project's activity log, marked as the portal.
Operations
GET /sso/:id/metadata,GET /sso/callback,POST /sso/:id/acs,GET /sso/completeare the browser endpoints. A SAML answer arrives by a cross-site POST (browsers withhold cookies from it), is validated, and the browser is redirected by a plain GET to/sso/complete, where the sign-in's own cookie decides who finishes it: another browser cannot, and the one-time token is spent either way.last_erroron a connection says what the last failure was, in words an IT admin can act on ("the signature … does not match the certificate on file").
Not built yet
IdP-initiated sign-in (off by design; it would be an opt-in per connection with its own risks), SAML single logout, signed AuthnRequests and encrypted assertions, certificate-expiry warnings, mapping the groups in a SAML or OIDC assertion to roles (directory sync maps SCIM groups to roles already), per-connection session policy, and Google Workspace / Entra / Okta guided setup pages. The dashboard's organization Single sign-on page covers domains, connections, directories and Admin Portal links.