Flows
A flow is a tenant-defined identity journey. Flows are how O2ID models the steps, decisions, and outcomes that make up experiences such as login, step-up checks, factor enrollment, account recovery, or application-specific identity verification.
Instead of wiring identity behavior directly into an application, define a flow as a graph: identify the user, verify a credential or factor, branch on user or tenant context, collect required enrollment, or finish with an outcome.
Clients never receive the full graph. They start a flow run, receive the
current nodeView, submit the values that node asks for, and receive the next
nodeView. O2ID owns the decisions about what step comes next.
Why use flows
With flows, a tenant can:
- Define the tenant's login journey.
- Require TOTP only for users who have it enrolled.
- Send users without TOTP through enrollment before continuing.
- Route successful steps through conditions before deciding the next step.
- Limit attempts and send repeated failures to a deny outcome.
- Reuse the same flow-run API for other tenant-defined identity triggers.
How a flow runs
A flow definition is a graph of named nodes:
{
"start": "identify",
"nodes": {
"identify": {
"type": "authenticator",
"id": "identifier",
"onSuccess": "password",
"onFailure": "identify"
},
"password": {
"type": "authenticator",
"id": "password",
"onSuccess": "allow",
"onFailure": "password"
},
"allow": {
"type": "outcome",
"properties": {
"result": "allow"
}
}
}
}
When a client starts a flow run, O2ID returns only the current nodeView. The
client renders that view, submits the requested values, and repeats until the
flow reaches an outcome.
Nodes that need user input return a nodeView. Decision-only nodes are handled
by O2ID and skipped over automatically until the run reaches another input
node or an outcome.
For the full node schema, see Flow Definition Schema.
The example above uses a separate identifier authenticator in front of
the password step — useful once you want to act on the resolved user
(branch on user.enrolledFactors, etc.) before checking the password, as
in Password plus TOTP below. For a plain password
login with nothing in between, a single node handles both — see Basic
password login, which is also what O2ID's
implicit default login flow uses.