You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(readme): sync documentation with current codebase
- Update Go version requirement from 1.21 to 1.25
- Add token-store parameter and keyring storage backend documentation
- Correct backoff strategy from multiplicative to additive per RFC 8628
- Update binary paths, timeouts, and development commands
- Remove references to deleted filelock.go and nonexistent make targets
- Bump golangci-lint install version to v2.11.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2. Rename tmp file to actual file (atomic operation)
101
-
3. On error, clean up temp file
88
+
-**`auto`** (default): `SecureStore` wraps keyring with file fallback. Warns if keyring is unavailable.
89
+
-**`keyring`**: Uses OS keyring via `TokenKeyringStore` (macOS Keychain, GNOME Keyring, Windows Credential Manager)
90
+
-**`file`**: Uses `TokenFileStore` with JSON file at the configured path
102
91
103
-
**File locking**: `saveTokens()` acquires an exclusive lock via `acquireFileLock()` to prevent race conditions during concurrent access. Lock files (`<tokenfile>.lock`) have stale lock detection (30s timeout) and automatic cleanup.
92
+
**Multi-client support**: All backends store tokens keyed by `client_id`. The `credstore.Store[credstore.Token]` interface provides `Load(clientID)` and `Save(clientID, token)` methods.
104
93
105
94
### OAuth Flow Implementation
106
95
@@ -115,12 +104,12 @@ The main flow is orchestrated by `run()`:
115
104
116
105
### Device Code Polling
117
106
118
-
`pollForTokenWithProgress()` implements RFC 8628 polling with exponential backoff:
107
+
`pollForTokenWithProgress()` implements RFC 8628 polling with additive backoff:
119
108
120
109
- Initial interval from server (default: 5s)
121
-
- On `slow_down` error: multiply interval by 1.5, cap at 60s
122
-
- Progress dots printed every 2s (UI update interval)
123
-
-Two separate tickers: one for polling, one for UI updates
110
+
- On `slow_down` error: adds 5s to interval per RFC 8628 §3.5, capped at 60s
111
+
- Progress reported via `Displayer` interface (TUI or plain text)
-CLI warns when OS keyring is unavailable and file storage is used
276
300
277
301
### Error Handling
278
302
@@ -308,7 +332,7 @@ The token was revoked or is invalid. Delete the token file and re-authenticate:
308
332
309
333
```bash
310
334
rm .authgate-tokens.json
311
-
./authgate-device-cli -client-id=<your-id>
335
+
./bin/device-cli -client-id=<your-id>
312
336
```
313
337
314
338
**`refresh failed`**
@@ -318,21 +342,29 @@ The CLI will automatically start a new device flow. Follow the browser authoriza
318
342
Normal behavior — the server returned a `slow_down` signal. The CLI has automatically increased its polling interval. See [Error Reference](#error-reference).
319
343
320
344
**`context deadline exceeded`**
321
-
A request timed out (30s limit). Check your network connection and server availability.
345
+
A request timed out. Check your network connection and server availability.
322
346
323
347
---
324
348
325
349
## Development
326
350
327
351
```bash
328
-
# Run tests
329
-
go test ./...
352
+
# Run tests with coverage
353
+
make test
354
+
355
+
# Build binary (output: bin/device-cli)
356
+
make build
357
+
358
+
# Lint and format
359
+
make lint
360
+
make fmt
330
361
331
-
# Build binary
332
-
go build -o authgate-device-cli
362
+
# Cross-platform builds
363
+
make build_linux_amd64
364
+
make build_linux_arm64
333
365
334
-
#Build with version info
335
-
go build -ldflags="-X main.version=1.0.0" -o authgate-device-cli
0 commit comments