Use environment auth
REPOST_TOKEN has the highest priority — it overrides credentials saved by repost auth login or repost auth token.
repost auth status --json. Use repost whoami --json when the agent also needs the active organization, plan, usage, or identity for later decisions.
method field is environment when REPOST_TOKEN is set and secure_storage otherwise. In this run the agent can perform read and write workflows, but it must not call --reveal-secrets, because secrets is absent from scopes.
This page owns the scope model. For how tokens are stored, the full lookup precedence, and config location, see Install & Auth in the CLI docs.
Cache identity for the run
Fetch identity once at the start of the run and keep it in the agent process. There is no reason to re-check before every operation — cache these fields and reuse them:
Refresh identity only when a command returns
unauthorized, active_org_required, forbidden_scope, or quota_exceeded, or when the workflow changes the token or organization.
Scope model
Create the narrowest token that can complete the workflow.Recover from auth errors
Auth and context errors mean the current identity cannot run the command as-is. Branch onerror.code, never the message.
active_org_required — no unambiguous organization
active_org_required — no unambiguous organization
A user token can see zero or multiple licensed organizations, so bucket and forwarder commands have no safe workspace target. Use an organization token for automation, or switch to a user context with exactly one licensed organization before retrying.
forbidden_scope — the token lacks a scope
forbidden_scope — the token lacks a scope
The token is valid but missing a required scope (HTTP 403). The full envelope also carries
forbidden_scope carries two fields you can act on directly:message, hint, and docs — see the error contract.1
Stop the mutation
Do not retry the same command with the same token.
2
Request the exact scope
Use
error.missing_scope — it names precisely what to add — and mint a token at error.token_creation_url.3
Or downgrade
If escalation isn’t possible, continue on a read-only path instead.
4
Do not over-grant
Request only the missing scope, not a broader token “to be safe.”
Use in CI
StoreREPOST_TOKEN in your CI provider’s secret store and export it only for the steps that need it. Because environment auth always wins, unset or shadow REPOST_TOKEN before testing a locally stored token.
For CLI token setup, see Install & Auth. For deploy gates, use repost forwarder pause and repost forwarder resume from the command reference.
Continue
Output & errors
The error envelope, exit codes, and how to branch on
error.code.Transcript safety
What
secrets scope exposes, and why redacted output is the default.Discovery
Read the command manifest and per-command schemas.