feat(cli): add 'coder login token' command to print session token (#21627)

Adds a new subcommand to print the current session token for use in
scripts and automation, similar to `gh auth token`.

## Usage

```bash
CODER_SESSION_TOKEN=$(coder login token)
```

Fixes #21515
This commit is contained in:
Kacper Sawicki
2026-01-29 16:06:17 +01:00
committed by GitHub
parent 9a417df940
commit d09300eadf
9 changed files with 123 additions and 0 deletions
+6
View File
@@ -15,6 +15,12 @@ coder login [flags] [<url>]
By default, the session token is stored in the operating system keyring on macOS and Windows and a plain text file on Linux. Use the --use-keyring flag or CODER_USE_KEYRING environment variable to change the storage mechanism.
```
## Subcommands
| Name | Purpose |
|----------------------------------------|---------------------------------|
| [<code>token</code>](./login_token.md) | Print the current session token |
## Options
### --first-user-email
+16
View File
@@ -0,0 +1,16 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# login token
Print the current session token
## Usage
```console
coder login token
```
## Description
```console
Print the session token for use in scripts and automation.
```