Skip to main content

Authentication

Login, registration, token issuance and session management.

πŸ“„οΈ Request GitHub OAuth URL

Build and return the GitHub OAuth authorization URL, using the configured client credentials and frontend callback, to which the browser should be redirected for authentication. `mode` selects the contract the callback will run: `register` (the default) registers or logs in, `login` never creates a user. Pass `verification_token` to start an invited account's setup instead: the returned URL carries a signed state bound to that token, and the callback only completes setup when GitHub's verified email matches the invited account's. `binding` (required) is the lowercase hex sha256 of the nonce the frontend start route keeps in a cookie on the starting browser; the signed state carries it and the callback refuses any other browser.

πŸ“„οΈ Exchange Web-Session JWT for CLI API Token

Called by the frontend /auth/cli page after the user authorizes the CLI. Mints a new CLI-named API token (90-day TTL), records it in the audit log and returns {token, email}. Only a signed-in web session may call it (an API token is refused with 403). Rate-limited to 5 exchanges per 60 seconds per IP and 10 token creations per hour per user (shared with POST /users/me/api-tokens). DEPRECATED (old TUIs only): answers with a Deprecation header while the CLI_LEGACY_EXCHANGE flag is on, and 410 upgrade_required (nothing minted) when off.