mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[GH-ISSUE #23668] Bug: admin-configured scopes overridden by discovered scopes_supported in static-credential OAuth flow #58706
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dhruvalgupta2003 on GitHub (Apr 13, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23668
Summary
In
get_oauth_client_info_with_static_credentials, the scope value is unconditionally set from the authorization server'sscopes_supportedmetadata when available. This silently overrides any custom scope string the admin supplied when registering the tool server.For setups that rely on scope bundling (e.g. registering multiple MCP servers backed by the same Entra AD app, so one consent grants access to all of them — Calendar + Mail + User in a typical M365 deployment), this override means the authorization request ends up with only the generic discovered scopes (e.g.
openid profile offline_access) and omits the custom resource scopes. Users get prompted for consent multiple times, or the resulting access token is missing the required audiences.Location
backend/open_webui/utils/oauth.pyaround lines 478–481:Impact
Suggested fix
Prefer the admin-provided scope if one was supplied; fall back to discovered
scopes_supportedonly when no explicit scope exists. Log when metadata-discovered scopes are being used so the behaviour is visible.@tjbck commented on GitHub (Apr 17, 2026):
Likely addressed with
349ea4ea9e.Dynamic Oauth2.1 should be used in general.
@p-ob commented on GitHub (Apr 22, 2026):
Was this issue actually resolved in
349ea4ea9e?Per https://datatracker.ietf.org/doc/html/rfc6749#section-3.3,
I agree that DCR or CIMD should be supported by IdPs, but for those IdPs that still require static client configuration, the ability for an admin in Open WebUI to be able to specify those scopes for static clients seems valuable.
Edit: On review of the MCP spec, I think the original behavior for when scopes aren't defined was what was originally implemented: https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#scope-selection-strategy