Skip to content

Conversation

@paircat
Copy link

@paircat paircat commented Jan 13, 2026

What does this PR do?

Authentication is enabled by default for server mode and uses 128-bit tokens.

  • Persistent tokens created and managed via CLI, stored in ~/.config/opencode/auth-tokens.json
  • Explicit permissions (read, write, execute), optional expiry (default: 90 days, or never)
  • Tokens can be created via CLI: opencode auth token {create,list,delete} with optional name, permissions, and expiry
  • Tokens default to full permissions, 90-day expiry, and are only shown once at creation

Permissions are inferred from the request:

  • GET, HEADread
  • POST, PUT, PATCH, DELETEwrite
  • Interactive endpoints (/pty, /session, /message) additionally require execute
  • Requests with missing permissions return 403

How did you verify your code works?

All tests pass; authentication was verified via updated server tests and manual server/TUI validation.

Authentication is enabled by default for server mode and uses 128-bit tokens.

- Persistent tokens created and managed via CLI, stored in ~/.config/opencode/auth-tokens.json
- Explicit permissions (`read`, `write`, `execute`), optional expiry (default: 90 days, or `never`)
- Tokens can be created via CLI: `opencode auth token {create,list,delete}` with optional name, permissions, and expiry
- Tokens default to full permissions, 90-day expiry, and are only shown once at creation

Permissions are inferred from the request:
- `GET`, `HEAD` → `read`
- `POST`, `PUT`, `PATCH`, `DELETE` → `write`
- Interactive endpoints (`/pty`, `/session`, `/message`) additionally require `execute`
- Requests with missing permissions return `403`
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@paircat
Copy link
Author

paircat commented Jan 13, 2026

Could help resolve #6355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant