Skip to main content
Authenticate with Sentry using OAuth device flow or an API token.

Usage

sentry auth login [options]

Description

Log in to Sentry using OAuth or an API token. The OAuth flow uses a device code - you’ll be given a code to enter at a URL. Alternatively, use --token to authenticate with an existing API token. The command will:
  • Check if you’re already authenticated (and skip if so)
  • Start an OAuth device flow (default) or validate the provided token
  • Fetch and cache your user information
  • Save credentials to your local configuration file
If authentication is provided via environment variable (SENTRY_AUTH_TOKEN or SENTRY_TOKEN), you’ll need to unset it to use OAuth-based login instead.

Options

--token
string
Authenticate using an API token instead of OAuth. The token will be validated by fetching user regions from the Sentry API.
--timeout
number
default:"900"
Timeout for OAuth flow in seconds. The default is 900 seconds (15 minutes).

Examples

OAuth login (default)

sentry auth login
Expected output:
Please visit: https://sentry.io/activate/DEVICE-CODE
Enter code: ABCD-EFGH

Waiting for authorization...
✓ Authenticated successfully
  Logged in as: [email protected]
  Config saved to: ~/.sentry/config.db

Login with API token

sentry auth login --token sntrys_YOUR_TOKEN_HERE
Expected output:
✓ Authenticated with API token
  Logged in as: [email protected] (username)
  Config saved to: ~/.sentry/config.db

OAuth with custom timeout

sentry auth login --timeout 300
For self-hosted Sentry instances (26.1.0+), set SENTRY_URL and SENTRY_CLIENT_ID environment variables before running the login command. You’ll need to create a public OAuth app in Settings → Developer Settings.

Build docs developers (and LLMs) love