Skip to content
Docs GitHub

auth

Authenticate with Sentry

Commands

sentry auth login

Authenticate with Sentry

Options:

OptionDescription
--token <token>Authenticate using an API token instead of OAuth
--timeout <timeout>Timeout for OAuth flow in seconds (default: 900)
--forceRe-authenticate without prompting

sentry auth logout

Log out of Sentry

sentry auth refresh

Refresh your authentication token

Options:

OptionDescription
--forceForce refresh even if token is still valid

sentry auth status

View authentication status

Options:

OptionDescription
--show-tokenShow the stored token (masked by default)
-f, --freshBypass 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:

OptionDescription
-f, --freshBypass cache, re-detect projects, and fetch fresh data

All commands support --json for machine-readable output and --fields to select specific JSON fields.

Examples

Terminal window
sentry auth login
  1. A URL and device code will be displayed
  2. Open the URL in your browser
  3. Enter the code when prompted
  4. Authorize the application
  5. The CLI automatically receives your token

Token login

Terminal window
sentry auth login --token YOUR_SENTRY_API_TOKEN

Self-hosted Sentry

Terminal window
SENTRY_URL=https://sentry.example.com sentry auth login

For token-based auth with self-hosted:

Terminal window
SENTRY_URL=https://sentry.example.com sentry auth login --token YOUR_TOKEN

See Self-Hosted Sentry for details.

Check auth status

Terminal window
sentry auth status
Authenticated as: username
Organization: my-org
Token expires: 2024-12-31
Terminal window
# Show the raw token
sentry auth status --show-token
# View current user
sentry auth whoami

Credential Storage

Auth tokens are stored in a SQLite database at ~/.sentry/config.db with restricted file permissions.

Environment Variable Precedence

The CLI checks for auth tokens in the following order, using the first one found:

  1. SENTRY_AUTH_TOKEN environment variable (legacy)
  2. SENTRY_TOKEN environment variable
  3. The stored token in the SQLite database

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