Skip to main content
A customer never signs in with a password during contracting. They enter with a one-time link sent by email, the portal exchanges it for a contract session, and the password is created only at the end of the flow.

Lifecycle

Registration and every access recovery send the same email (“continue your contract”) with a one-time link to /{locale}/contract/{id}?action_link=…. The link is a Supabase Auth magic link: it can be redeemed once and expires after a while. POST /api/v3/contract/{id}/sessions is public; the one-time token is the credential. The backend:
  1. Loads the contract (404 when it does not exist).
  2. Verifies the token with Supabase Auth.
  3. Checks that the user takes part in the contract (see below).
  4. Issues an internal token and builds the current ContractState.
It answers { jwt, state }. The portal seeds its contract cache from that response, so the wizard paints the right step with no extra request. The internal token carries a unique identifier, so a single session can be revoked. For a company contract, when account-centric identity is on, the token names the signer’s person account and carries the company as the organization; a person contract names the person account.

Who may call each step

Every wizard call sends the contract session as a Bearer token. On the wizard routes (/api/v3/contract/{id}/… for each step) the backend checks, on each call, that the token is valid, that the contract exists, that the token’s organization (company contracts) or account is the contract’s account, and that the user takes part in it in one of two roles: When a user is both, account_member wins. Steps reserved to account members answer 403 to a contract_signer. The code and signing routes (/api/v3/signature/{id}/signer/{signer}/*) check instead that the session user owns that signer seat. The portal stores the session bound to its contract id, so a session from one contract is never reused on another.

Re-entry

A customer who comes back through a new link after verifying identity gets a fresh session. Before that session can request a signing code, the customer proves the identity card serial again:
  • ContractState raises flags.require_signer_document_number.
  • Code, sign and reject requests answer 422 reentry-serial-required until the serial is proved.
  • PATCH /api/v3/contract/{id}/identity checks the serial with Floid and answers with a new session marked as re-verified.
A session that never left the wizard keeps its original token and skips this check. See Identity.

Access recovery

When the session cannot start (401, 403, 410, a 409 with no stored session for this contract, an expired stored session, or no link and no stored session), the portal shows a recovery screen instead of sending the customer to the Horizon sign-in page. Only an invalid contract id or a server error takes the customer out of the wizard. The two resend endpoints answer 409 for a contract in a final status (active, cancelled, rejected, expired). The lookup only searches contracts that can still continue, so a final contract sends no link. All three answer 429 when their limit is spent.

Portal password and handoff

Each signer creates a portal password with PATCH /api/v3/contract/{id}/password once their own signature is done (before that, the call answers 409 invalid-stage).
  • The response carries the updated ContractState and a short-lived handoff token (handoff_bbx). The portal uses it to open the customer portal already signed in. If no handoff can be minted, the portal falls back to the normal sign-in.
  • A signer who already has a password gets only the handoff: nothing is written (a password sent anyway must still meet the rules), and no stage check applies.
  • A later company administrator gets their own person account here (created or reused), and the handoff opens the portal on that account.

Code