Docs Guides

Sign people in and call t10

Sign people in from a web, desktop, mobile or mini-program app, then call modules, agents and auth-server with their token, and sign them out.

An app that works for a person signs them in with auth-server, then calls t10 with that person's access token. Every service verifies the token itself and takes the tenant from it, so the app never sends a tenant or user ID of its own. This guide covers the order: register, sign in, call, sign out.

auth-server is the only issuer. Its public address is the issuer in every token: http://localhost:8081 in Compose. auth-server/docs/api.md has every route.

Pick your kind of client#

Your app Client type Signs in with Example
A web app with its own server confidential, with a secret The authorization-code flow with PKCE, from the server Workbench, Property's web app, the console
A desktop app public, no secret The same flow, with a loopback redirect t10-mac-client
The mobile app public, direct_login Name and password, with requests signed by the device's keys flutter, through mobile-api.md
A WeChat mini-program public, wechat WeChat's login code, then a password The property employee mini-program
A script or test grant_type=password, in dev mode only t10-quickstart/check.sh

A browser app should keep tokens on its server and give the browser a session cookie, as Workbench does. A service acting as itself, not for a person, uses a service token instead: see service-api.md.

1. Register the client#

Add an entry to auth-server/clients.yaml, the reviewed list of first-party clients. t10-quickstart has its own copy in config/clients.yaml.

- id: t10-my-app
  name: My app
  type: confidential
  tenant: required                    # ask someone in several tenants to pick one
  redirect_uris:                      # matched exactly; list each deployment's
    - http://127.0.0.1:<port>/auth/callback
  secret_sha256: <sha256 of the secret in your app's .env>
  idle_ttl: 12h
  absolute_ttl: 168h

tenant: none makes sessions that hold no tenant, as the console's do. A public desktop client lists http://127.0.0.1/callback, and any port matches.

2. Sign the person in#

From a Go server, use websession. t10-modkit/websession does the whole flow: PKCE, the callback, sessions in your own Postgres table with tokens sealed at rest, refresh, tenant switching and sign-out. Workbench, the console and Property's web app all use it.

Otherwise, the flow by hand:

  1. Send the browser to GET /v1/authorize with client_id, redirect_uri, state, code_challenge, code_challenge_method=S256, and optionally tenant and lang.
  2. The person signs in on auth-server's pages, which handle passwords, second factors, QR sign-in from the phone, and choosing a tenant.
  3. At your callback, check state, then redeem the code at POST /v1/token with grant_type=authorization_code, code, redirect_uri, code_verifier, client_id, and client_secret for a confidential client.
  4. You get an access_token and a refresh_token. Refresh before the access token expires with grant_type=refresh_token. The refresh token rotates, so keep the new one.

To switch tenant, refresh with tenant=<id>. A tenant that requires a second factor answers 403 mfa_required until the person enrols one. A person in several tenants who names none gets 400 invalid_request.

3. Call t10 with the person's token#

Send Authorization: Bearer <access_token> on every call.

To reach Call Reference
The person, their tenants and their apps auth-server: GET /v1/me/access, GET /v1/me/homes, GET, PUT /v1/me/preferences auth-server/docs/api.md
A module's records The module's /v1/… routes. From the cluster, its service address. From outside, the public modules route /modules/<id>/v1/…, once a deployment runs modules-ingress.yaml Each module's docs/api.md, such as collab's
An agent, by text ai-gateway-agent: POST /agent with Agent-Method, and GET /agent for the event stream. Name the agent with Agent-Name on session.create ai-gateway/docs/api.md, the agent contract
An agent, by voice message ai-gateway-agent: GET /agent/voice, a WebSocket voice-messages.md
An agent, on a live call Join a room: POST /v1/rooms/admission at auth-server, then the room protocol t10-livekit-agent/docs/api.md

Rules every service applies:

  • Modules refuse what you can't see with 404, the same as a missing record, and what you can see but can't change with 403.
  • Check what a person may do with GET /v1/me/access and GET /v1/me/permissions?module=<id> to draw buttons and menus. They're hints: each module still decides on every call.
  • Don't call Workbench's /api/… routes. They're the backend for Workbench's own web app and take its session cookie. Call the services directly.

4. Sign the person out#

All t10 web apps share one sign-out: signing out of any of them ends every t10 web session in that browser.

  • With websession, SignOut ends your session and answers where to send the browser to end the rest.
  • By hand, POST /v1/me/browser-logout with {client_id, return_to} returns a one-time ticket. Send the browser to GET /v1/signout/complete with it.
  • A native app revokes its refresh token with POST /v1/revoke.

sign-in-and-landing.md explains the front door, the tenant picker and the shared sign-out.

5. Look like the rest of t10#

Optional, for a web app that people move to from Workbench. Draw the shared frame from the web kit in t10-modkit/web (rail, Apps list from GET /v1/me/homes, account menu), and read and save the person's language and theme with /v1/me/preferences, so a choice in one app shows in all of them. See one-system.md.

Generated from t10’s own docs (bbc3cde). Spotted a problem? Tell us.