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
{{ message }}
Repository navigation
Commit de6a899
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): Name both orgs when an org auth token targets another org (#2168)
Stacked on #2165.
Split out of #2160.
An org auth token works only in its own org. When it targets another
org, Sentry answers 403 if both orgs are on the same server, or 401
"Invalid org token" if they aren't, and neither response says why. The
CLI now compares the org in the token (`sntrys_…`) with the org in the
request path and names both orgs when they differ.
### Before
`release create` for `other-org`, with an org auth token for `my-org` in
`SENTRY_AUTH_TOKEN`:
```
Error: Failed to create release: 403 Forbidden
You do not have permission to perform this action.
Your SENTRY_AUTH_TOKEN token may lack the required scope for this operation.
Check token scopes at: <sentry-url>/settings/account/api/auth-tokens/
```
```
Error: Failed to create release: 401 Unauthorized
Invalid org token
Your SENTRY_AUTH_TOKEN token is not recognized or has been revoked.
Create a new token at: <sentry-url>/settings/account/api/auth-tokens/
```
### After
```
Error: Failed to create release: 403 Forbidden
You do not have permission to perform this action.
This org auth token belongs to organization 'my-org', but the request is for 'other-org'.
Use an auth token created in 'other-org', or target 'my-org' instead.
```
```
Error: Failed to create release: 401 Unauthorized
Invalid org token
This org auth token belongs to organization 'my-org', but the request is for 'other-org'.
Use an auth token created in 'other-org', or target 'my-org' instead.
```
These errors are recorded with `denial_reason: org_mismatch` (#2163).
Numeric org IDs are skipped, and the org comparison ignores case.
<!-- junior-request-attribution:start -->
via @betegon.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A28e783cd48c13b214d69caf6d8977a0c -->
--
[View Session in
Sentry](https://sentry.sentry.io/explore/conversations/agent%3A28e783cd48c13b214d69caf6d8977a0c/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: bete <28983162+betegon@users.noreply.github.com>
0 commit comments