fix(web): always request offline_access for MCP refresh_token grant#1292
fix(web): always request offline_access for MCP refresh_token grant#1292fatmcgav wants to merge 3 commits into
offline_access for MCP refresh_token grant#1292Conversation
Atlassian (and other providers) only honour the `refresh_token` grant when `offline_access` is included in the authorization scope. The client was already declaring `refresh_token` in `clientMetadata.grant_types` but never injecting `offline_access` into `requestedOAuthScopes`, so the /authorize request was incomplete and Atlassian rejected it. - `PrismaOAuthClientProvider` now appends `OFFLINE_ACCESS_SCOPE` before normalization so it appears in both `clientMetadata.scope` and the /authorize request. Injection is unconditional (matching the existing behaviour of always declaring `refresh_token`); a comment explains the tradeoff vs checking `oauthScopesSupported`. - `buildMcpOAuthScopeEntries` defaults `offline_access` to enabled when present in available scopes so the admin UI reflects what will be sent. - New `oauthScopeUtils.test.ts` covers the default-enabled behaviour and general normalization/filtering helpers. - Updated `prismaOAuthClientProvider.test.ts` to assert `offline_access` is always present and that it is not duplicated when already supplied. - Added a note to the connectors doc explaining why `offline_access` is pre-ticked in the OAuth scopes UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ot-dev#1292] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR ensures MCP OAuth connectors always request the ChangesMCP OAuth Offline Access Scope
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ccess` injection Both mocks asserted `clientMetadata.scope === 'repo'`; the scope is now `'offline_access repo'` after the fix in the previous commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Atlassian (and other providers) only honour the
refresh_tokengrant whenoffline_accessis included in the authorization scope. The client wasalready declaring
refresh_tokeninclientMetadata.grant_typesbut neverinjecting
offline_accessintorequestedOAuthScopes, so the /authorizerequest was incomplete and Atlassian rejected it.
PrismaOAuthClientProvidernow appendsOFFLINE_ACCESS_SCOPEbeforenormalization so it appears in both
clientMetadata.scopeand the/authorize request. Injection is unconditional (matching the existing
behaviour of always declaring
refresh_token); a comment explains thetradeoff vs checking
oauthScopesSupported.buildMcpOAuthScopeEntriesdefaultsoffline_accessto enabled whenpresent in available scopes so the admin UI reflects what will be sent.
oauthScopeUtils.test.tscovers the default-enabled behaviour andgeneral normalization/filtering helpers.
prismaOAuthClientProvider.test.tsto assertoffline_accessisalways present and that it is not duplicated when already supplied.
offline_accessispre-ticked in the OAuth scopes UI.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Summary by CodeRabbit
Bug Fixes
Documentation
Tests