mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[GH-ISSUE #19794] MCP OAuth 2.1: Not following WWW-Authenticate → Protected Resource → Authorization Server discovery chain #34525
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 @jamie-dit on GitHub (Dec 7, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19794
Bug Description
When adding a Todoist MCP server (
https://ai.todoist.net/mcp) with OAuth 2.1 authentication, clicking "Register Client" fails with a 400 Bad Request error. However, Todoist's OAuth infrastructure is correctly configured according to the MCP specification.Steps to Reproduce
https://ai.todoist.net/mcpRoot Cause Analysis
The MCP OAuth 2.1 specification requires clients to follow a discovery chain. Todoist implements this correctly:
1. MCP Server returns 401 with WWW-Authenticate header
2. Protected Resource Metadata points to Authorization Server
3. Authorization Server has OAuth metadata with DCR endpoint
4. DCR endpoint works correctly
The Problem
Open WebUI appears to look for OAuth metadata directly at
{MCP_SERVER_URL}/.well-known/oauth-authorization-server(which returns 404 forai.todoist.net), instead of:WWW-Authenticateheader to get the Protected Resource metadata URLExpected Behavior
Open WebUI should follow the full MCP OAuth discovery chain as specified in the MCP Authorization spec.
Environment
https://ai.todoist.net/mcp(Todoist official)Workaround
Using Bearer token authentication via the Headers field works:
Related Issues
@owui-terminator[bot] commented on GitHub (Dec 7, 2025):
🔍 Similar Issues Found
I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:
#18010 issue: MCP OAuth 2.1 flow doesn't match standard (missing code_challenge and resource_url)
by hsuyuming • Oct 02, 2025 •
bug#14119 feat: Enable per-user authentication in MCP for personalized tool access or consider implementing a proper MCP Client
by florianchappaz • May 21, 2025
#19778 issue: Streamable HTTP Notion MCP server doesn't stay enabled after authorizing
by Sam-Horry • Dec 05, 2025 •
bug💡 Tips:
This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
@jamie-dit commented on GitHub (Dec 7, 2025):
Update: Fix submitted
I've identified the root cause and submitted a fix in PR #19795.
Root Cause
The current implementation only looks for OAuth metadata at
{MCP_SERVER_URL}/.well-known/oauth-authorization-server, but according to the MCP spec, when the OAuth server is on a different domain, clients should follow the Protected Resource discovery flow:POST ai.todoist.net/mcp→ 401 +WWW-Authenticate: Bearer resource_metadata="https://ai.todoist.net/.well-known/oauth-protected-resource/mcp"GET ai.todoist.net/.well-known/oauth-protected-resource/mcp→{"authorization_servers": ["https://todoist.com"]}GET todoist.com/.well-known/oauth-authorization-server→{"registration_endpoint": "https://todoist.com/oauth/register", ...}POST todoist.com/oauth/register→ ✅ DCR worksVerification
I've tested the fix on a live Open WebUI instance and confirmed Todoist OAuth registration now works correctly.
Workaround
Until the PR is merged, you can use Bearer token authentication instead:
{"Authorization": "Bearer YOUR_TOKEN"}@jamie-dit commented on GitHub (Dec 7, 2025):
Updated: PR #19795 was closed (wrong base branch). New PR targeting
dev: #19796