Skip to content

Commit 86a7ca1

Browse files
betegonclaude
andcommitted
docs: reframe credential storage docs for new users
Rename "Reading the Token Externally" to "Direct Database Access" and broaden the framing to orient new users on inspecting stored data rather than just extracting a token. Add expires_at query example. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4cc8fc8 commit 86a7ca1

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

docs/src/content/docs/commands/auth.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,20 @@ The CLI checks for auth tokens in the following order, using the first one found
106106

107107
When a token comes from an environment variable, the CLI skips expiry checks and automatic refresh.
108108

109-
### Reading the Token Externally
109+
### Direct Database Access
110110

111-
Other tools can read the stored token directly from the database. The config directory defaults to `~/.sentry/` but can be overridden with the `SENTRY_CONFIG_DIR` environment variable.
111+
If you need to inspect your stored credentials or integrate the CLI's auth with other tools, you can query the database directly. The config directory defaults to `~/.sentry/` but can be overridden with the `SENTRY_CONFIG_DIR` environment variable.
112112

113113
```bash
114+
# Read the current access token
114115
sqlite3 ~/.sentry/cli.db "SELECT token FROM auth WHERE id = 1;"
116+
117+
# Check token expiry
118+
sqlite3 ~/.sentry/cli.db "SELECT datetime(expires_at / 1000, 'unixepoch') FROM auth WHERE id = 1;"
115119
```
116120

117121
Keep in mind a few caveats when accessing the database from outside the CLI:
118122

119-
- **Token expiry** — Check `expires_at` before using the token. The CLI automatically refreshes tokens when they are close to expiring, but an external reader will not trigger a refresh.
123+
- **Token expiry** — Check `expires_at` before using the token. The CLI automatically refreshes expired tokens, but reading the database directly will not trigger a refresh.
120124
- **WAL mode** — The database uses SQLite WAL (Write-Ahead Logging). Open it in read-only mode to avoid lock contention with a running CLI process.
121-
- **Env var precedence** — If `SENTRY_AUTH_TOKEN` or `SENTRY_TOKEN` is set, the CLI uses that instead of the database value. We recommend following the same precedence in external tools.
125+
- **Env var precedence** — If `SENTRY_AUTH_TOKEN` or `SENTRY_TOKEN` is set, the CLI ignores the database value. Follow the same precedence in external tools.

docs/src/content/docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,4 @@ We store credentials and caches in a SQLite database (`cli.db`) inside the confi
145145
- Region URL mappings
146146
- Project aliases (for monorepo support)
147147

148-
Other tools can query the database directly to read the stored auth token. See [Credential Storage](./commands/auth/#credential-storage) in the auth command docs for the schema and usage details.
148+
Other tools can query the database directly to inspect stored credentials and cached data. See [Credential Storage](./commands/auth/#credential-storage) in the auth command docs for the full schema and access details.

0 commit comments

Comments
 (0)