Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 29 Nov 2026. What's built · Install 0.6.0
jadpo
ReferenceSign-in and identity

APIsSign-in and identity

Narrowing an API token to scopes

A token for an app that should do less than its person may, such as a read-only widget, is issued narrowed to some scopes. api_token: declares them as external_token: does, each a name and its scope-token, and sessions.issue_token names them:

example
authentication {    api_token: {        scopes: {            notes_read: "notes:read"            notes_write: "notes:write"        }    }}action widget_sign_in(token: InvitationToken) fails InvitationExpired -> AppSignedIn {    var invitation: Invitation = attempt Invitation.redeem(token)    return AppSignedIn {        token: sessions.issue_token(invitation.member_id, scopes: [OAuthScope.notes_read])    }}
  • Policy holds a narrowed token exactly as it holds a provider's (Scopes): it does what both its person's grants and its scopes allow.
  • scopes: comes after the user's id and lists each scope once, at least one; each is one api_token: declares (type.token_scopes_invalid). A token issued without scopes: may do whatever its person may, as every token issued before scopes did.
  • A scope both api_token: and external_token: declare is one scope: its name reads the same scope-token in both, or it is semantic.auth_setting_invalid.
  • jadpo_sessions keeps the scope-tokens beside the token's verifier, and with a revocation delay the token's signed part carries them, so a delay never widens a token. IssuedToken's scopes lists them, and is none for a token that isn't narrowed and for a browser session.

Markdown for agents: /docs/narrowing-an-api-token-to-scopes.md.Built from Jadpo's main branch at commit 9080dc3.