mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #23696] [CLOSED] fix(oauth): prefer admin-provided scope over discovered scopes_supported in static-credential flow #66175
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23696
Author: @Anai-Guo
Created: 4/14/2026
Status: ❌ Closed
Base:
main← Head:fix-oauth-static-scope-override📝 Commits (3)
52f78a9fix(oauth): prefer admin-provided scope over discovered scopes_supported in static-credential flow045e604fix(oauth): accept explicit scope in OAuthClientRegistrationForm for static credentialsef91db2fix(oauth): preserve stored scope when re-authenticating static OAuth clients📊 Changes
3 files changed (+9 additions, -3 deletions)
View changed files
📝
backend/open_webui/main.py(+1 -0)📝
backend/open_webui/routers/configs.py(+2 -0)📝
backend/open_webui/utils/oauth.py(+6 -3)📄 Description
Fixes #23668
Problem
get_oauth_client_info_with_static_credentialsunconditionally overwrites the OAuth scope with the authorization server'sscopes_supportedmetadata:This breaks setups that rely on scope bundling — e.g. registering multiple MCP servers backed by the same Entra AD/Azure app where a single consent should cover Calendar + Mail + User resource scopes. The metadata endpoint returns only generic OpenID scopes (
openid profile offline_access), so the actual resource scopes are lost, causing repeated consent prompts or missing token audiences.Fix
Three-part change:
utils/oauth.py— add an optionalscopeparameter toget_oauth_client_info_with_static_credentials. The discoveredscopes_supportedis used only when no explicit scope was provided (and a debug log makes this visible).routers/configs.py— addscope: Optional[str] = NonetoOAuthClientRegistrationFormand forward it to the function, so admins can supply a custom scope string when registering a tool server with static credentials.main.py— when re-authenticating an existing static-credential client (refreshing endpoints), read the scope that was persisted in the encrypted client-info blob and pass it back, so the scope is preserved across re-auth cycles.Behaviour
scopes_supportedscopes_supportedscopes_supportedNoneNone(unchanged)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.