Tokens: identity and authority
FlowCatalyst is an OAuth 2.0 and OpenID Connect provider. It issues tokens for two different jobs, and it keeps them apart on purpose:
- An id_token tells an application who signed in and what that person holds inside the application. It is an assertion to the application.
- An access token lets its holder call the platform API. It is a credential.
Most of the design on this page follows from not letting one do the other’s job.
Which grant gives which token
Section titled “Which grant gives which token”flowchart TB cc["client_credentials<br/>(service account or developer credential)"] ac["authorization_code + PKCE<br/>(a person signs in to an app)"] rt["refresh_token<br/>(interactive logins only)"] api["API access token<br/>token_use = api<br/>tier, roles, scope, applications"] idt["Identity access token<br/>token_use = identity<br/>no authority, refused by the API"] idtok["id_token (with openid)<br/>5 minutes, roles narrowed to the app"] ac -- "default client" --> idt ac -- "apiAccess client" --> api ac --> idtok rt --> idt rt --> api rt --> idtok cc --> api
The diagram shows that machines always get an API access token, while a person signing in to an application gets an id_token plus an access token that carries no authority, unless that application’s OAuth client is explicitly allowed API access.
The id_token: an assertion to the application
Section titled “The id_token: an assertion to the application”When someone signs in to an application through FlowCatalyst (authorization code with PKCE, S256
only), the application receives an id_token if it asked for the openid scope.
- Audience. Its
audis the application’s OAuthclient_id. It is meant for that application and nobody else. - Short-lived. It lives for 5 minutes, a fixed lifetime independent of the access token’s. An application reads it once, at sign-in, and starts its own session from it. Nothing should keep it around as a credential.
- Scoped to the application. When the OAuth client is limited to one or more applications, the
rolesclaim keeps only the roles of those applications, and theapplicationsclaim is cut down to them. An application never learns which roles its users hold in other applications. - Roles, not permissions. The id_token carries role names such as
orders:dispatcher. Mapping a role to its permissions is the application’s own business: it declared that mapping itself (permissions and roles). - Honest timing.
auth_timeis when the person actually signed in, carried through refreshes, so an application can apply its own maximum session age.
It also carries the person’s sub (their prn_ id), name, email, type, tier, home client
(client_id, when they have one) and clients.
The access token: a credential
Section titled “The access token: a credential”An access token is a signed JWT (RS256 by default) that the platform API accepts as a bearer token. Its default
lifetime is one hour (FC_JWT_ACCESS_TOKEN_TTL_SECS). Every access token carries a token_use
claim that puts it in one of two classes:
token_use |
Issued to | Carries | Accepted by the API |
|---|---|---|---|
api |
The client-credentials grant (service accounts, developer credentials); interactive logins through an OAuth client flagged apiAccess |
tier, clients, roles, applications, granted permissions in scope |
Yes |
identity |
Interactive logins through any other OAuth client | Who the person is; empty authority claims | No, refused by the API |
The API’s check is an allowlist: only api (or the absent marker of a console session or a legacy
token) is admitted. Any other class, including identity and the tokens of the
field-worker plane, is refused, so a future token class is closed to the
API by default.
An identity access token still has uses: it satisfies the OAuth requirement that a token response
contain an access token, and it can call /oauth/userinfo, which answers with the same confinement
the application’s id_token had.
Why a relayed user token cannot act as the user
Section titled “Why a relayed user token cannot act as the user”Suppose a person signs in to a third-party reporting application through FlowCatalyst. If the access token that application received could call the platform API, the application could act as that person: read everything they can read, change everything they can change. A leaked browser token would do the same.
FlowCatalyst closes that door. An interactive login gets an identity token by default, so whatever an application does with it, it cannot drive the platform API. When an application needs the platform API, it calls as itself, with its own service account and its own, narrower permissions.
apiAccess: the explicit exception
Section titled “apiAccess: the explicit exception”A trusted first-party application, such as an operator console built on FlowCatalyst, may need to
call the API as the signed-in person. Its OAuth client can be flagged apiAccess. Its interactive
logins then receive token_use=api tokens, narrowed to the client: only the roles of the client’s
applications, the person’s applications intersected with the client’s, and permissions derived from
those narrowed roles. An application-scoped client can never mint authority beyond its own
applications, however broad the person’s own access is.
The authority claims
Section titled “The authority claims”| Claim | Holds |
|---|---|
tier |
ANCHOR, PARTNER or CLIENT: how far the principal reaches across clients (tenancy) |
clients |
["*"] for an anchor, otherwise id:identifier pairs for each client reached |
applications |
["*"] for every application, otherwise id:code pairs (applications) |
all_applications |
The older boolean form of "*" in applications. Deprecated, still emitted |
roles |
The principal’s role names |
scope |
The granted permissions, space-separated |
type |
USER or SERVICE |
azp |
The OAuth client the token was minted through, when there is one |
scope is a real OAuth scope: a list of permission codes. By default it is the principal’s whole
permission ceiling, flattened from its roles. A caller can ask for less by sending scope on the
token request; it receives the intersection with its ceiling, never more. Permissions it does not hold
are dropped. If a client-credentials request asks only for permissions the principal does not hold, the
answer is invalid_scope. The OpenID scopes (openid, profile, email, offline_access and so on)
are not permissions and are not counted.
Why narrow. A job that only publishes events can hold a token that only publishes events. If that token leaks, the damage is bounded by what was asked for, not by everything the service account may do.
Refresh tokens
Section titled “Refresh tokens”Only interactive logins that ask for offline_access get a refresh token; the client-credentials
grant never does, because the client can simply ask again.
- Rotated on every use. Each refresh returns a new refresh token and retires the old one.
- Replays revoke the family. Presenting a retired refresh token revokes the whole family of tokens descended from the same sign-in. Of two concurrent presentations of one token, exactly one wins.
- Bound to its client. Only the OAuth client it was issued to can use it.
- Absolute deadline. A family dies a fixed time after the original sign-in (
OIDC_REFRESH_TOKEN_TTL, 7 days by default). Rotation never extends it. - Fresh authority. The new tokens are derived from the principal as it is now, so a role removed since sign-in is gone after the next refresh, and a deactivated account cannot refresh.
Signing keys
Section titled “Signing keys”When FLOWCATALYST_APP_KEY is set, the platform keeps its signing keys in the database (FC_JWT_KEY_STORE=database, the default) and rotates them on its own. It holds a key for each algorithm: RS256, EdDSA (Ed25519) and ML-DSA-65 for tokens, and a separate HS256 key for session cookies. The asymmetric keys rotate every 90 days and the HS256 key every 30. A new key is published at /.well-known/jwks.json for a day (five minutes for HS256) before it signs, so relying parties’ cached key sets pick it up, and a retired key keeps verifying until the longest token it could have signed has expired. Discovery is at /.well-known/openid-configuration.
A first start adopts the RSA key already in configuration as the active RS256 key under its existing kid, so tokens in circulation stay valid. Session cookies are HS256 and never appear in the key set. An operator can list keys, rotate one at once or expire one with fc-server signing-keys list | rotate | expire; the runbook is Rotate the signing keys. With FC_JWT_KEY_STORE=config the platform keeps the older behaviour: the configured key is used as is and never rotated. The platform refuses to start with no key at all.
Access tokens are RS256 unless the operator sets FC_JWT_ACCESS_TOKEN_ALG=EdDSA. Do that only when every SDK that verifies your access tokens supports EdDSA. Field tokens and client assertions stay RS256.
ID-token algorithm per OAuth client. An OAuth client chooses the algorithm of its ID tokens with id_token_signed_response_alg, in the console’s OAuth client form or through the API: RS256 (the default), EdDSA or ML-DSA-65. The key set always holds a key for every algorithm, so a client can switch without an operator step, and discovery lists all three. A relying party must support the algorithm it picks.
Console sessions
Section titled “Console sessions”The console uses a session cookie rather than a bearer token. The cookie carries an authority-bearing session token and is only honoured for state-changing requests from the platform’s own origin, which closes cross-site request forgery. It is the platform’s own session and is never handed to an application.
Read next
Section titled “Read next”- Token claims reference: every claim of every token.
- Use FlowCatalyst as your app’s identity provider
- Call the platform API as a service account
- Decision: id_token as an assertion, access token as a credential
- Decision: session tokens are owned by sessiontoken
- OAuth and OIDC routes outside the OpenAPI document