feat(cli): add 'coder login token' command to print session token by kacpersaw · Pull Request #21627 · coder/coder

Documentation Check

Updates Needed

  • docs/admin/users/sessions-tokens.md - Add a section showing how to use coder login token to retrieve the current session token for use in scripts and automation (similar to the gh auth token pattern mentioned in issue Allow fetching current auth token via CLI #21515)
  • docs/ai-coder/ai-bridge/client-config.md - Update the Authentication section (line 18-23) to mention that users can retrieve their session token using coder login token rather than only referencing long-lived API keys
  • docs/ai-coder/ai-bridge/client-config.md - Update the example in the PR description to show in the docs (the CODER_SESSION_TOKEN=$(coder login token) and AI Bridge usage patterns)

Context

The PR adds a new coder login token command that prints the current session token for use in scripts and automation, similar to gh auth token. While the CLI reference docs are auto-generated and included, the feature documentation could benefit from:

  1. Session token documentation should explain this new retrieval method alongside the existing /cli-auth URL method
  2. AI Bridge documentation currently only mentions long-lived API keys for external clients but could show the new command as a way to retrieve session tokens for scripting
  3. Usage examples from the PR description (setting ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL) would be valuable to include

The auto-generated CLI docs at docs/reference/cli/login_token.md are already included and correct.


Automated review via Coder Tasks