Skip to content

fix authenticated_server_python WWW-Authenticate formatting#199

Draft
chi5477 wants to merge 1 commit intoopenai:mainfrom
chi5477:fix/authenticated-www-authenticate-header
Draft

fix authenticated_server_python WWW-Authenticate formatting#199
chi5477 wants to merge 1 commit intoopenai:mainfrom
chi5477:fix/authenticated-www-authenticate-header

Conversation

@chi5477
Copy link
Copy Markdown

@chi5477 chi5477 commented Feb 25, 2026

Summary

This PR fixes a formatting bug in the OAuth challenge string returned by the Python authenticated MCP example.

What was wrong

In authenticated_server_python/main.py, the generated WWW-Authenticate challenge concatenated error and error_description without a comma separator.

Before:

  • error="..."error_description="..."

This produces a malformed challenge value and can cause OAuth clients to parse the auth hint inconsistently.

Root cause

A missing delimiter in _build_www_authenticate_value(...) when composing challenge parameters.

Fix

Add the missing comma+space between error and error_description in the formatted string.

After:

  • error="...", error_description="..."

Validation

  • Triggered unauthenticated call to protected tool see_past_orders via /mcp.
  • Confirmed mcp/www_authenticate now returns a correctly formatted challenge:
    • Bearer error="invalid_request", error_description="No access token was provided", resource_metadata="..."

Scope

  • Minimal change: one-line fix in one file.
  • No behavior changes outside authenticated challenge formatting.

@chi5477 chi5477 changed the title [codex] fix authenticated_server_python WWW-Authenticate formatting fix authenticated_server_python WWW-Authenticate formatting Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant