Commands
auth
Authenticate with Sentry
Commands
sentry auth login
Authenticate with Sentry
Options:
| Option | Description |
|---|---|
--token <token> | Authenticate using an API token instead of OAuth |
--timeout <timeout> | Timeout for OAuth flow in seconds (default: 900) |
--force | Re-authenticate without prompting |
sentry auth logout
Log out of Sentry
sentry auth refresh
Refresh your authentication token
Options:
| Option | Description |
|---|---|
--force | Force refresh even if token is still valid |
sentry auth status
View authentication status
Options:
| Option | Description |
|---|---|
--show-token | Show the stored token (masked by default) |
-f, --fresh | Bypass cache, re-detect projects, and fetch fresh data |
sentry auth token
Print the stored authentication token
sentry auth whoami
Show the currently authenticated user
Options:
| Option | Description |
|---|---|
-f, --fresh | Bypass cache, re-detect projects, and fetch fresh data |
All commands support --json for machine-readable output and --fields to select specific JSON fields.
Examples
OAuth login (recommended)
sentry auth login- A URL and device code will be displayed
- Open the URL in your browser
- Enter the code when prompted
- Authorize the application
- The CLI automatically receives your token
Token login
sentry auth login --token YOUR_SENTRY_API_TOKENSelf-hosted Sentry
SENTRY_URL=https://sentry.example.com sentry auth loginFor token-based auth with self-hosted:
SENTRY_URL=https://sentry.example.com sentry auth login --token YOUR_TOKENSee Self-Hosted Sentry for details.
Logout
sentry auth logoutRefresh token
sentry auth refreshPrint stored token
sentry auth tokenCheck auth status
sentry auth statusAuthenticated as: usernameOrganization: my-orgToken expires: 2024-12-31# Show the raw tokensentry auth status --show-token
# View current usersentry auth whoamiCredential Storage
Auth tokens are stored in a SQLite database at ~/.sentry/cli.db with restricted file permissions.
Environment Variable Precedence
The CLI checks for auth tokens in the following order, using the first one found:
SENTRY_AUTH_TOKENenvironment variableSENTRY_TOKENenvironment variable (legacy alias)- The stored OAuth token in the SQLite database
When a token comes from an environment variable, the CLI skips expiry checks and automatic refresh.