mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 04:16:03 -05:00
[GH-ISSUE #23667] Bug: PKCE (S256) not enforced for OAuth 2.1 when authorization server metadata omits code_challenge_methods_supported #35568
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/23667
Summary
OAuth 2.1 requires PKCE. In the current client registration,
code_challenge_method='S256'is only added when the authorization server advertisescode_challenge_methods_supportedin its metadata. If that field is missing from discovery (or discovery itself is unavailable), the Authlib client is configured without PKCE and the resulting authorization request has nocode_challenge.For providers that require PKCE (Microsoft Entra ID public clients, and many modern IdPs), this causes authorization to fail — the redirect round-trips but the token exchange is rejected.
Location
backend/open_webui/utils/oauth.pylines 535–543:Impact
Silent auth failure against Entra ID and other PKCE-required providers. The exact failure mode is confusing because discovery/callback look fine until the token endpoint returns an error.
Suggested fix
Default
code_challenge_methodto'S256'for OAuth 2.1 clients, and only downgrade/skip if metadata explicitly advertises only alternative methods. Per RFC 9700 (OAuth 2.1), PKCE is mandatory.