fix: accept offline_access OAuth scope for MCP refresh clients#2630
fix: accept offline_access OAuth scope for MCP refresh clients#2630rohanpatel2002 wants to merge 1 commit into
Conversation
|
I think supporting the scope or ability to define custom scopes is an option, but would require platform work / configuration beyond this auth pr. In it's current I don't think we could accept it as it would become the new default for all customers, which may have broader security implications. I'll let @cemalkilic chime in on this. |
|
Datum here (filed #2628) — thanks for taking a look, @cstockton. Opt-in per-project works perfectly for us; we're not asking for this as a global default. A per-project config toggle fully addresses the security concern — we'd only ever enable it deliberately on our own project. The narrow need: MCP clients (Copilot Studio, ChatGPT, claude.ai) only use the refresh token they already receive when Happy to test against a preview build whenever useful. Thanks both! |
|
Thanks for raising it @alana-datum and for the contribution @rohanpatel2002! @rohanpatel2002 Could you update/rebase the |
b3b8b4a to
bfc329f
Compare
|
Thanks @cemalkilic — I’ve rebased this branch onto the latest Quick recap of the change: No other code changes in this update; happy to adjust further if anything else comes up in review. |
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
The OAuth 2.1 authorization server already issues refresh tokens on the authorization-code grant and supports the
refresh_tokengrant. However,offline_accessis not in the supported scope allowlist (SupportedOAuthScopes), so:GET /oauth/authorize?...&scope=openid%20offline_accessfails witherror=invalid_request/unsupported scope: offline_access/.well-known/oauth-authorization-serveradvertisesscopes_supported: ["openid","profile","email","phone"]withoutoffline_accessMCP clients (Copilot Studio, ChatGPT, and similar) often require
offline_accessto be advertised and granted before they will use refresh tokens. Without it, they hold unused refresh tokens, access tokens expire after ~1 hour, and users are forced to re-authenticate.Fixes #2628
What is the new behavior?
offline_accessis added toSupportedOAuthScopes(accept-and-ignore). Because authorize validation and discovery metadata both use that shared list:offline_accesssucceedoffline_accessinscopes_supportedNo change to token issuance: refresh tokens were already issued unconditionally when configured.
Additional context
Single-source change in
internal/models/oauth_scope.go, with a unit test assertingIsSupportedScope("offline_access"). Happy to adjust if maintainers prefer a different approach. Thank you for reviewing.