Sign-in and federation
FlowCatalyst is the identity provider for every application on it. People type their credentials only into pages the platform hosts, and the platform decides, from the email address alone, how each person signs in: with a password (and a second factor if one is owed), with a passkey, or at their own organisation’s identity provider.
This page covers the main identity plane: platform users (see Principals). Portal users and field workers sign in through planes of their own, described in Portal identity and Field-worker identity.
One question decides the route: who owns the email domain?
Section titled “One question decides the route: who owns the email domain?”Every sign-in starts with an email address. The platform looks up the address’s domain in the
email-domain mappings and follows the mapping to an identity provider (idp_):
- A provider of type
INTERNALmeans the platform itself checks the credentials: a password or a passkey. - A provider of type
OIDCmeans an outside organisation’s sign-in service (for example Microsoft Entra ID, Google Workspace or Keycloak) checks them. The platform federates to it. - A domain with no mapping is treated as internal.
flowchart TD
E[Person enters email] --> M{Email domain mapped?}
M -->|no| PW[Platform credentials]
M -->|yes, INTERNAL provider| PW
M -->|yes, OIDC provider| SSO[Redirect to the organisation's IdP]
PW --> K{How?}
K -->|passkey| S[Session]
K -->|password| F{Second factor owed?}
F -->|yes| C[TOTP, email PIN or recovery code] --> S
F -->|no| S
SSO --> CB[Callback checks: signature, issuer,<br/>audience, nonce, domain, tenant]
CB --> S
The mapping table is the single source of truth for routing, and every surface reads it: the
sign-in page, the password endpoint, password reset, invitations and the portal plane. A domain
mapped to an OIDC provider never accepts a password. The password endpoint refuses it with
SSO_REQUIRED, and password reset skips federated accounts, so the organisation’s provider stays
the only authority for its people. Disable someone there and they cannot get in here.
Why route by domain. People do not know, and should not need to know, which provider their company uses. Their email address is something they always know, and a domain is something an organisation can show it owns. Routing on it gives one sign-in page for everyone.
The mapping carries tenancy, not just routing
Section titled “The mapping carries tenancy, not just routing”An email-domain mapping is more than a pointer to a provider. It also says what a new user from that domain becomes:
| Field | Meaning |
|---|---|
scopeType |
ANCHOR, PARTNER or CLIENT: the tier of a user created from this domain |
primaryClientId |
The home client of a CLIENT user created from this domain |
grantedClientIds, additionalClientIds |
Further clients a user from this domain reaches |
requiredOidcTenantId |
For a multi-tenant provider, the one tenant whose tokens are accepted |
require2fa, allowed2faMethods, rememberDevice… |
The second-factor policy for password sign-in |
When someone signs in through an organisation’s provider for the first time, the platform creates their user just in time, with the scope and home client from the mapping. Nothing about scope comes from the incoming token, so a person who can edit their own claims at the provider still cannot promote themselves.
The scope is always explicit. When an administrator adds domains to an identity provider, each
new mapping must be ANCHOR, or CLIENT with a client, chosen on purpose. Without that choice the
API refuses the request with MAPPING_SCOPE_REQUIRED, and the check runs before any row is
written. PARTNER mappings are managed on the email-domain page. The reason is that ANCHOR is the
most powerful tier: a silent default there would make every user from a newly added domain a
platform operator. For the same reason a stored scope the platform cannot read is an error, never
a guess.
The OIDC bridge
Section titled “The OIDC bridge”When a domain belongs to an outside organisation, the platform acts as an OIDC client of that
organisation’s provider. This part is the OIDC bridge (/auth/oidc/*).
sequenceDiagram autonumber participant B as Browser participant FC as FlowCatalyst participant Org as Organisation IdP B->>FC: email (domain mapped to an OIDC provider) FC->>FC: store login state (state, nonce, PKCE verifier), 10 minutes FC-->>B: redirect to the IdP's authorize endpoint B->>Org: sign in (their password, their MFA) Org-->>B: redirect back with a code B->>FC: /auth/oidc/callback?code&state FC->>FC: consume the login state (once) FC->>Org: exchange the code (client credential + PKCE verifier) Org-->>FC: id_token FC->>FC: verify signature, expiry, issuer, audience, nonce FC->>FC: email domain = login domain, tenant pinned, no guest accounts FC->>FC: find or create the user, sync roles FC-->>B: session cookie, then back to where sign-in began
The checks on the way back are what make federation safe:
- Single-use state. The login state is deleted as it is read, so a callback cannot be replayed, and it expires after 10 minutes.
- PKCE and nonce. The code exchange sends the PKCE verifier (method
S256only, as on the platform’s own authorize endpoint), and the token’snoncemust match the stored one. - Token verification. Signature (RSA or EC keys from the provider’s JWKS), expiry, issuer and audience. For a multi-tenant provider, whose issuer differs per tenant, the issuer is matched against the provider’s configured issuer pattern, and the audience is still checked against the platform’s own client id.
- A provider may only vouch for its own domains. The email in the token must be in the domain
the sign-in started with. If the mapping pins a tenant, the token’s
tidmust equal it. Guest accounts from other organisations (#EXT#user names) are refused. Optionally (FC_OIDC_REJECT_UNVERIFIED_EMAIL), an explicitemail_verified: falseis refused too. - Safe redirects. After sign-in the browser goes only to a same-site relative path, or back into the OAuth request that sent it, never to an absolute URL taken from the request.
For a provider open to many organisations these layers add up: a token must come from an issuer the pattern allows, carry an email in the mapped domain, and (when pinned) carry the expected tenant id.
The issuer pattern must be pinned. A multi-tenant provider’s oidcIssuerPattern must be anchored
at both ends (^…$), contain no wildcard, character range or repeat, and spell out at most 32 exact
issuers, for example ^https://login\.microsoftonline\.com/<tenant-id>/v2\.0$. A broad pattern
(one that would also match another organisation’s issuer) is refused when you save the provider
(ISSUER_PATTERN_NOT_PINNED). A provider saved before the rule keeps signing in, but the platform logs
a warning at start-up and on first use, and the console’s identity-provider drawer flags it. Once no
provider is flagged, set FC_OIDC_ISSUER_PATTERN_REQUIRE_PINNED=true to refuse every sign-in through an unpinned
pattern. FC_OIDC_ISSUER_PATTERN_STRICT=true is a stopgap for legacy patterns: it makes an unpinned
one a full match instead of a partial match.
How the platform proves itself to the provider. At the code exchange the platform is a
confidential client of the provider, and an OIDC identity provider has a client authentication
setting with one of three methods (oidcClientAuthMethod, set in the console’s identity-provider
form or through the API; the default is CLIENT_SECRET):
| Method | The token request carries | Expires |
|---|---|---|
CLIENT_SECRET |
The stored client secret | Yes. An Entra secret lasts at most 24 months, and when it expires every sign-in through the provider fails at the code exchange. |
CERTIFICATE |
A client assertion (RFC 7523 private_key_jwt) signed with a certificate key the platform generated |
The certificate is valid for 24 months. You generate the next one, upload it to the provider, then make it active. |
FEDERATED |
A client assertion signed with the platform’s own RS256 signing key | No. The provider is configured to trust the platform as an issuer and fetches its keys from /.well-known/jwks.json, so the platform must be reachable from the internet on a public https address. |
For CERTIFICATE the private key is generated on the platform, stored encrypted and never leaves it;
the administrator downloads the public certificate and uploads it to the provider. A new assertion is
minted for every exchange. A stored secret is kept when you switch method, so you can switch back.
The certificate buttons are in the console’s identity-provider page. A client assertion is not a platform credential: the platform refuses it at its own
endpoints. The Entra steps for each method are in the platform’s identity and access document
(docs/published/30-identity-and-access.md).
With the secret method, the provider’s client secret is stored encrypted with the application key and decrypted only when the bridge builds its client. A decryption failure stops sign-in with a clear error; there is no fallback.
Every federated sign-in, accepted or refused, is recorded as a login attempt with its reason, and
a successful one emits the platform event platform:iam:user:logged-in.
Role sync from the organisation
Section titled “Role sync from the organisation”An identity provider can also hand over roles. When syncRolesFromIdp is on, every federated
sign-in reads the token’s roles claim and reconciles the user’s platform roles from it:
- Each provider role is translated through the IdP role mappings to a platform role. A provider role with no mapping is refused and logged.
- If the provider has an allow-list (
allowedRoleIds), only roles on it can be granted. - The result replaces the user’s roles that came from the provider. Roles an administrator assigned by hand are left alone.
An empty claim means something: a person removed from every group upstream loses every synced role at their next sign-in. The two filters mean a compromised or misconfigured provider can never grant a role nobody mapped. A failure in role sync does not block sign-in; the user keeps the roles they had.
Passkeys
Section titled “Passkeys”Users of internal domains can register passkeys (WebAuthn) and sign in with one instead of a
password. A passkey sign-in is passwordless and is not challenged for a second factor: a passkey is
a key pair whose private half never leaves the person’s device or password manager, so there is
no shared secret to phish or guess. Failed passkey
attempts count against the same per-email, per-address backoff as passwords. The relying-party id
and allowed origins are deployment settings (FC_WEBAUTHN_RP_ID, FC_WEBAUTHN_ORIGINS). How
passkeys relate to the password path is on
Second factors and password policy.
Where sign-in sits in OAuth
Section titled “Where sign-in sits in OAuth”Applications never call these endpoints themselves. They send the browser to /oauth/authorize
(authorization code with PKCE). If the browser has no platform session, the platform shows its
sign-in page, runs whichever route above applies, sets its own fc_session cookie, and resumes the
authorization request so the application receives its code. A person who has signed in is not
asked again by the next application until that session ends (24 hours by default,
OIDC_SESSION_TTL). What the application then receives is on Tokens.
A sign-in page in the client’s colours
Section titled “A sign-in page in the client’s colours”The sign-in page, and the emails the platform sends, use a login theme: brand name, colours,
logo and footer, stored as platform configuration. An
application can ask for a particular client’s branding by adding client=<client identifier> to
its /oauth/authorize request. The platform then layers that client’s theme over the global one,
field by field.
The hint picks colours and nothing else. It is not checked against the OAuth client, an unknown identifier falls back to the global theme, and a malformed one is dropped, so a bad hint can never break sign-in.
Read next
Section titled “Read next”- Connect an organisation’s SSO: set up a provider, its domains and role sync.
- Use FlowCatalyst as your app’s identity provider.
- Second factors and password policy.
- Tokens: identity and authority.
- Routes outside the OpenAPI document:
/oauth/*and/auth/*. - ADR 0023: IdP domain mappings need an explicit scope.
- Runbook: IdP login failures.