Skip to content

Commit 84b3489

Browse files
appleboyclaude
andcommitted
docs(readme): sync documentation with current codebase
- Update Go version prerequisite from 1.24+ to 1.25+ - Add missing -token-store flag and TOKEN_STORE env var - Document multi-backend token storage (auto, file, keyring) - Fix build command to use Makefile output path - Add OS keyring entry to security notes table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4b43e34 commit 84b3489

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A CLI tool that authenticates with an AuthGate server by opening your browser, t
2323

2424
## Prerequisites
2525

26-
- **Go 1.24+**
26+
- **Go 1.25+**
2727
- A running [AuthGate](https://github.com/go-authgate) server
2828
- An OAuth client registered in AuthGate Admin with:
2929
- Grant type: **Authorization Code**
@@ -74,14 +74,17 @@ SCOPE=read write
7474

7575
# Token storage
7676
TOKEN_FILE=.authgate-tokens.json
77+
# Token storage backend: auto (default), file, keyring
78+
# auto = use OS keyring if available, fallback to TOKEN_FILE
79+
TOKEN_STORE=auto
7780
```
7881

7982
### 3. Run
8083

8184
```bash
8285
go run .
8386
# or build first:
84-
go build -o authgate-oauth-cli && ./authgate-oauth-cli
87+
make build && ./bin/oauth-cli
8588
```
8689

8790
---
@@ -152,6 +155,7 @@ All settings can be provided as flags, environment variables, or in a `.env` fil
152155
| `-port` | `CALLBACK_PORT` | `8888` | Local port for the callback server |
153156
| `-scope` | `SCOPE` | `read write` | Space-separated OAuth scopes |
154157
| `-token-file` | `TOKEN_FILE` | `.authgate-tokens.json` | Token storage file path |
158+
| `-token-store` | `TOKEN_STORE` | `auto` | Storage backend: `auto`, `file`, or `keyring`|
155159

156160
### Examples
157161

@@ -211,7 +215,7 @@ PKCE (Proof Key for Code Exchange) is used for all clients — including confide
211215
On every run the CLI follows this decision tree:
212216

213217
```
214-
Load token from disk
218+
Load token from store
215219
216220
├─ Not found ──────────────► Full Authorization Code Flow
217221
@@ -224,15 +228,23 @@ Load token from disk
224228
└─ Refresh fails ──► Full Authorization Code Flow
225229
```
226230

227-
- **Reuse**: Valid tokens are loaded from disk and used immediately.
231+
- **Reuse**: Valid tokens are loaded from the configured store and used immediately.
228232
- **Refresh**: Expired access tokens are refreshed silently using the stored refresh token.
229233
- **Re-auth**: If the refresh token is also expired or invalid, the full Authorization Code Flow restarts.
230234

231235
---
232236

233237
## Token Storage
234238

235-
Tokens are saved to `.authgate-tokens.json` (configurable). The file supports multiple client IDs so you can authenticate against several clients without conflicts:
239+
The CLI supports multiple storage backends, configured via `-token-store` or `TOKEN_STORE`:
240+
241+
| Mode | Description |
242+
| --------- | ------------------------------------------------------------------ |
243+
| `auto` | Use OS keyring if available, fall back to file (default) |
244+
| `file` | JSON file at the path specified by `-token-file` |
245+
| `keyring` | OS keyring (macOS Keychain, GNOME Keyring, Windows Credential Manager) |
246+
247+
When using file-based storage, tokens are saved to `.authgate-tokens.json` (configurable). The file supports multiple client IDs so you can authenticate against several clients without conflicts:
236248

237249
```json
238250
{
@@ -263,6 +275,7 @@ The file is written with `0600` permissions and uses atomic rename to prevent co
263275
| Token in transit | TLS 1.2+ enforced for all HTTPS connections |
264276
| Accidental plaintext exposure | Warning printed when `SERVER_URL` uses plain HTTP |
265277
| Token file permissions | Written as `0600`; uses atomic rename to prevent corruption |
278+
| Token storage at rest | OS keyring preferred (`auto` mode); file fallback with `0600` perms |
266279

267280
---
268281

0 commit comments

Comments
 (0)