You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for the OAuth 2.0 Device Authorization Grant (RFC
8628) to the API authentication docs.
This documents the device code flow implemented in
getsentry/sentry@d4e4b74, which enables
headless clients (CLI tools, CI/CD pipelines, Docker containers) to
authenticate without a browser on the device.
The new section covers:
- When to use the device flow vs standard OAuth
- Requesting device codes from `/oauth/device/code/`
- Displaying user codes and verification URLs
- Polling the token endpoint with proper interval handling
- Error responses (`authorization_pending`, `slow_down`,
`access_denied`, `expired_token`)
- Complete Python example implementation
---------
Co-authored-by: Claude Opus 4.5 <[email protected]>
A Sentry user can belong to multiple organizations. The access token only provides access to the specific organization the user selected during the OAuth flow. The `/api/0/organizations/` endpoint will only return the connected organization.
115
115
116
+
### Device Authorization Flow
117
+
118
+
The device authorization grant ([RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628)) enables applications on devices without a browser or with limited input capabilities to obtain authorization. This is ideal for CLI tools, CI/CD pipelines, Docker containers, and other headless environments where redirecting to a browser on the same device isn't practical.
119
+
120
+
**How it works:** Your application requests a device code, displays a short user code to the user, and polls for authorization. The user visits Sentry in their browser (on any device), enters the code, and approves the request. Once approved, your application receives an access token.
121
+
122
+
#### Step 1: Request Device Code
123
+
124
+
Request a device code from the device authorization endpoint:
125
+
126
+
```bash
127
+
curl -X POST https://sentry.io/oauth/device/code/ \
128
+
-d client_id={CLIENT_ID} \
129
+
-d scope=org:read%20project:read
130
+
```
131
+
132
+
**Parameters:**
133
+
| Parameter | Required | Description |
134
+
|-----------|----------|-------------|
135
+
|`client_id`| Yes | Your registered client ID |
136
+
|`scope`| No | Space-separated list of [permissions](/api/permissions/)|
0 commit comments