Sign-in, sharing and access¶
Without options, peitho serve runs for one person on 127.0.0.1 and asks nobody to sign in. To share decks with other people, turn on sign-in with any OpenID Connect provider: Google Workspace, Microsoft Entra ID, Okta, Keycloak, Authentik...
Once sign-in is on:
- every page and API call needs a signed-in user, and each deck is visible only to the people it is shared with;
- the CLI signs in once with
peitho login; - MCP clients (Claude Code, VS Code, any client that supports MCP authorization) sign in with the same SSO through OAuth 2.1. Peitho is the authorization server of its
/mcpendpoint: no token to copy around.
1. Create an OAuth client at your provider¶
The redirect URI is <public URL>/auth/callback, for example https://slides.example.com/auth/callback.
Google Workspace: in the Google Cloud console, open APIs & Services → Credentials → Create credentials → OAuth client ID, type Web application, and add the redirect URI. Set the OAuth consent screen to Internal so that only your organization can sign in. The issuer is https://accounts.google.com.
Microsoft Entra ID: register an application with a Web redirect URI. The issuer is https://login.microsoftonline.com/<tenant id>/v2.0.
Okta, Keycloak, Authentik...: create an OIDC web application (authorization code flow) and use the issuer URL the provider shows.
2. Start the server¶
export PEITHO_OIDC_CLIENT_SECRET=... # never on the command line
peitho serve --addr 0.0.0.0:8790 --url https://slides.example.com --data /srv/peitho \
--oidc-issuer https://accounts.google.com --oidc-client-id 1234.apps.googleusercontent.com \
--allowed-domains example.com --admins marco@example.com
| Flag | Environment | Meaning |
|---|---|---|
--url |
PEITHO_URL |
public URL, used for redirects and links (required with sign-in) |
--oidc-issuer |
PEITHO_OIDC_ISSUER |
turns sign-in on |
--oidc-client-id |
PEITHO_OIDC_CLIENT_ID |
OAuth client id |
PEITHO_OIDC_CLIENT_SECRET |
OAuth client secret | |
--allowed-domains |
PEITHO_ALLOWED_DOMAINS |
comma-separated email domains that may sign in (with one domain, Google only offers accounts of that domain) |
--allowed-emails |
PEITHO_ALLOWED_EMAILS |
extra addresses allowed whatever their domain (external reviewers) |
--admins |
PEITHO_ADMINS |
people who see and manage every deck |
PEITHO_SESSION_KEY |
key that signs session cookies (32 bytes or more); by default a random key kept in <data>/auth/session.key (or in the database) |
Without --allowed-domains or --allowed-emails, any account of the provider can sign in: fine for an internal Keycloak, not for Google. Peitho refuses to listen on a non-loopback address without sign-in unless you pass --insecure-no-auth. Put it behind HTTPS (a reverse proxy or a load balancer): session cookies are marked Secure when the public URL is https.
3. Roles and sharing¶
| Role | Can |
|---|---|
| viewer | open the deck, its versions and comments |
| commenter | + comment, reply, resolve, suggest text edits |
| editor | + publish new versions, mark edits applied or rejected |
| owner | + change sharing. The person who published the deck first. |
The owner shares a deck from the review panel (Share): add people by email with a role, and optionally give a role to everyone signed in (everyone your domains allow). Admins have every right on every deck. Decks published before sign-in was turned on have no owner: everyone signed in can view them and admins manage them.
Comments, replies and versions carry the name of the signed-in person: the name typed in the widget is only used without sign-in.
4. CLI¶
peitho login --server https://slides.example.com
peitho publish slides.md
peitho login opens the browser, you approve, and the CLI receives a token on a loopback port (valid 90 days). Tokens are stored in ~/.config/peitho/credentials.json (macOS: ~/Library/Application Support/peitho/), one per server. In CI, set PEITHO_TOKEN instead. peitho logout forgets the local token.
5. MCP clients¶
claude mcp add --transport http peitho https://slides.example.com/mcp
In Claude Code, run /mcp, choose peitho and Authenticate: your browser opens, you sign in with the SSO and approve. VS Code does the same when it first connects. The agent then acts as you: it sees the decks you can see, and the replies it posts are tagged agent and name you.
Under the hood, /mcp answers 401 with a link to its protected resource metadata; Peitho publishes authorization server metadata, accepts dynamic client registration of public clients, and issues access tokens (1 hour) and rotating refresh tokens (30 days) with the authorization code flow and PKCE. A client that cannot do OAuth can send a CLI token as Authorization: Bearer <token>.
Storage¶
<data>/auth/session.key signs the cookies and <data>/auth/tokens.json keeps the registered OAuth clients and the SHA-256 of every token (never the tokens themselves). Delete a line of tokens.json, or the whole file, to revoke tokens. With PostgreSQL storage both live in the peitho_blobs table (keys auth/session.key and auth/tokens.json), so every instance shares them; delete the auth/tokens.json row to revoke every token.