You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9333a51
Browse filesBrowse the repository at this point in the historyBrowse files
fix(auth): no error code for a request that presented no credentials
RFC 6750 Section 3.1 says a request that carried no credentials SHOULD NOT be
answered with an error code, but the bearer gate collapsed the no-header case
into the same challenge as an invalid token and emitted error="invalid_token".
The challenge also never carried the `scope` parameter, which the spec SHOULD
include for both the discovery-time 401 and the runtime 403 -- and which this
SDK's own client reads (utils.py extract_scope_from_www_auth) to drive
step-up, so the gap was a resource-server/client asymmetry.
Split the two cases:
* no Authorization header -> 401 with resource_metadata and scope, no error
code, and an empty body
* presented but invalid token -> 401 with error="invalid_token", plus scope
* insufficient scope -> 403 with error="insufficient_scope" and the required
scope named
The scope parameter is optional on _send_auth_error and is joined outside the
f-string: nested same-type quotes in an f-string need PEP 701 (3.12+) and this
project supports 3.11.
Resolves the divergences recorded on hosting:auth:missing-401,
hosting:auth:scope-403 and hosting:auth:invalid-401; those entries no longer
carry a divergence, and the tests that pinned the old challenge now pin the
corrected one.
Closes#3769
Copy file name to clipboardExpand all lines: docs/run/authorization.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,17 +67,28 @@ You registered one tool. The second route is the SDK's.
67
67
This document is how a client that has never heard of your server finds its way in: it reads `authorization_servers` and goes there for a token. You wrote none of it.
68
68
69
69
!!! check
70
-
Call `/mcp` with no token (or with one your verifier returned `None` for) and the request is
0 commit comments