Skip to content

Latest commit

 

History

History
90 lines (60 loc) · 2.26 KB

File metadata and controls

90 lines (60 loc) · 2.26 KB

Development Guide

Prerequisites

Setup

  1. Install dependencies:
bun install
  1. Create a .env.local file in the project root:
SENTRY_CLIENT_ID=your-sentry-oauth-client-id

Get the client ID from your Sentry OAuth application settings.

Note: No client secret is needed - the CLI uses OAuth 2.0 Device Authorization Grant (RFC 8628) which is designed for public clients.

Running Locally

bun run --env-file=.env.local src/bin.ts auth login

Testing the Device Flow

  1. Run the CLI login command:
bun run --env-file=.env.local src/bin.ts auth login
  1. You'll see output like:
Starting authentication...

Opening browser...
If it doesn't open, visit: https://sentry.io/oauth/device/
Code: ABCD-EFGH

Waiting for authorization...
  1. The browser will open to Sentry's device authorization page
  2. Enter the code and authorize the application
  3. The CLI will automatically receive the token and save it

Sentry OAuth App Configuration

When creating your Sentry OAuth application:

  • Redirect URI: Not required for device flow
  • Scopes: The CLI requests these scopes:
    • project:read, project:write
    • org:read
    • event:read, event:write
    • member:read
    • team:read

Environment Variables

Variable Description Default
SENTRY_CLIENT_ID Sentry OAuth app client ID (required)
SENTRY_URL Sentry instance URL (for self-hosted) https://sentry.io

Building

bun run build

Architecture

The CLI uses the OAuth 2.0 Device Authorization Grant (RFC 8628) for authentication. This flow is designed for CLI tools and other devices that can't easily handle browser redirects:

  1. CLI requests a device code from Sentry
  2. User is shown a code and URL to visit
  3. CLI polls Sentry until the user authorizes
  4. CLI receives access token and stores it locally

No proxy server is needed - the CLI communicates directly with Sentry.