Skip to content

Setup link reference

For: an app developer who turns on the setup links, or who writes the setup page of its own.

What it does: this page lists each part of the setup link in one place. Each route has its full entry on the routes page. The steps are in Set up SSO with a setup link.

Option Value Rule
sso.setup { ttlHours?, page? } or false Off when absent or false. It needs sso, which needs organizations.
sso.setup.ttlHours whole number, 1 to 168 The default life of a link. The default is 72. A mint may name its own ttlHours in the same range.
sso.setup.page function Replaces the setup page of core. It takes the page input and returns HTML.
account.notices boolean sso.setup throws a ConfigError at start when this is false. An owner learns of a ready setup by a notice only.

Any other key of sso.setup throws a ConfigError.

An organization holds at most 2 live links. A live link is not revoked, not ended, and not expired. The mint answers setup_link_limit past it. The calls of sso.setupLinks need a manager with a second factor on.

The setup link routes exist only when sso.setup is on.

Route Who calls it
POST /sso/setup-links/create An owner, or a platform operator
GET /sso/setup-links/list An owner, or a platform operator
GET /sso/setup-links/get An owner, or a platform operator
POST /sso/setup-links/revoke An owner, or a platform operator
POST /sso/setup-links/activate An owner, or a platform operator
GET /sso/setup The IT admin, with the link
POST /sso/setup/open The IT admin, with the link
POST /sso/setup/domains/add The setup session
POST /sso/setup/domains/verify The setup session
GET /sso/:connectionId/start?test=1 The setup session, or a manager. It starts a test sign-in of a draft. While sso.setup is off, the flag has no effect
POST /sso/setup/connection The setup session
POST /sso/setup/scim-token The setup session
POST /sso/setup/handback The setup session
GET /sso/setup/status The setup session

The setup session is the cookie __Host-tempo_setup. A bearer token or a normal session cookie does not open a setup route.

The calls of sso.setupLinks need a signed-in manager. The calls of sso.setup need the setup cookie, so make that client with no token. The full list is in Client.

The server API has no setupLinks call. A server holds no setup cookie and no manager session, so it calls the routes.

Name When To whom
sso_setup_ready After a handback Every owner of the organization
sso_activated After an activation Every owner of the organization
hooks.sso.setupReady({ organizationId, linkId }) After the commit of a handback Your code. A throw writes one log line, and the handback stays.

A notice is a mail. A failed mail writes one log line, and the change stays. An owner with no address gets no mail.

Each connection of GET /sso/connections holds status. api.sso.connections.list answers the same SsoConnectionStatus.

Field What it holds
lastSuccessAt The time of the last real sign-in that passed, or null.
lastFailureAt The time of the last real sign-in that failed, or null.
lastFailureStep The step of that failure, or null.
certificateEndsAt The end of the SAML certificates: the latest notAfter. Null on an OIDC connection.
expiryStage The last expiry notice that the sweep claimed: 30, 7, or 1. Null before the first notice.
  • Core writes lastSuccessAt, or lastFailureAt and lastFailureStep, at most once an hour for each field. A test run writes none of them.
  • The write keeps updatedAt, so it does not change the lock of a manager update.
  • A failed write never fails the sign-in. It emits sso.status_write_failed and writes the line authtempo: sso status write failed.
  • A connection from before schema version 18 holds null in each field. Its first real sign-in after the upgrade fills the certificate end and the notice date.

The sweep tells the owners when an SSO credential ends soon. The step is ssoExpiryNotices of the sweep. Without a scheduled sweep, no notice goes out.

Kind The end The stages
saml_certificate The latest notAfter of the certificates of an enabled SAML connection 30, 7, and 1 days
scim_token expiresAt of a SCIM token. A token with no expiry gets no notice 30, 7, and 1 days
setup_link expiresAt of a live setup link. A link lives at most 168 hours 1 day only

For each stage of a row, the sweep does these steps in this order:

  1. It claims the stage with one conditional write on the row. Of two sweeps at once, only one wins, so the owners get one notice.
  2. It mails the sso_expiring notice to the owners: each member whose role holds the owner rank. At most 10 owners get a mail.
  3. It emits the event sso.expiring.
  4. It runs hooks.sso.expiring({ organizationId, kind, id, at }).
  • A late sweep sends one notice for the smallest due stage, and skips the larger stages.
  • The claim is the record. A failed mail writes notice.mail_failed with sso_expiring. No sweep sends that mail again.
  • The owner read skips each member that holds exactly one role below the owner rank. It reads one page of 100 of the other members. These are the owners, the members with a comma list of roles, and the members with a dynamic role.
  • More than 50 role names below the owner rank pass the parameter bound of D1. Then the read skips no member, and any 100 members fill the page.
  • More than 100 members that the read keeps cut the scan. Then an owner past the page gets no mail, and the step writes notice.mail_failed with a RangeError.
  • ownersCut of the event counts the owners past the 10 mails.
  • With account.notices off, no mail goes out. The event and the hook still run.
  • A write of new certificates starts the stages again from the new end.
  • A draft gets no notice. Its notice date starts at the activation.
  • A disabled connection gets no notice, and keeps its notice date. After an enable, the next sweep sends the nearest due stage.
  • A revoked or ended setup link, and a row whose end is past, loses its notice date and gets no notice.
  • hooks.sso needs sso. With scim alone, a SCIM token gets the mail and the event, and no hook.
  • A row from before schema version 18 gets its dates at its next use. A SAML connection gets them at its next sign-in or certificate write. A SCIM token gets them at its next SCIM call. A setup link from before version 18 gets no notice.

Warning: a mail goes through your mail supplier, which can drop it. Do not use the mail as the only signal. Use hooks.sso.expiring or the event sso.expiring as the signal that you own. Send it to your own alert or ticket system.

  • The events are sso.setup_opened and sso.setup_refused. See Events.
  • The expiry events are sso.expiring and sweep.sso_expiry_stopped. The status event is sso.status_write_failed.
  • Each limit has the key setup-open, setup-page, setup-draft, setup-status, or setup-test. See Limits.
  • The codes setup_link_invalid, setup_link_limit, and setup_not_tested are in Errors.

GUIDES of @authtempo/core holds one typed record for each provider: okta, entra, google-workspace, generic-saml, and generic-oidc. The setup page and the pages below read the same record. Each record has the date of its read, checkedOn. A step or a launch text may have an unconfirmed reason. The release check fails when a checkedOn is older than 180 days.