Repository navigation
[Doc] Bound the token endpoint error docs to what sets the readers - #633
Merged
koic merged 1 commit intoOct 26, 2026
Merged
Conversation
## Motivation and Context The "Token endpoint errors" section opens with "When a token exchange or refresh fails", but the readers it describes are set only when the token endpoint answers with a non-2xx response within the body cap: a transport failure, a body over the cap, and a 2xx response with a broken body all raise `AuthorizationError` with `nil` readers. The section also leaves unsaid that `InvalidGrantError` is chosen on the raw `error` while the `error` reader holds the sanitized value, so a code the server padded, `"invalid_grant\n"` say, reads back as `error == "invalid_grant"` yet raises `AuthorizationError`; a reader inferring the class from the reader would get it wrong. The section now states the condition and the distinction. The sentence that other authorization failures have `nil` readers predates the authorization callback error of 1.7.0, which sets `error` and `error_description` with `http_status` left `nil`; the section now says so. A blank diagnostic field reads as `nil` as well, since the sanitizer strips it; the section says so too. ## How Has This Been Tested? Docs only. Both statements were checked against `token_endpoint_error` and `bounded_request` in `lib/mcp/client/oauth/flow.rb`. The callback sentence was checked against `authorization_response_error`. ## Breaking Changes None.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
The "Token endpoint errors" section opens with "When a token exchange or refresh fails", but the readers it describes are set only when the token endpoint answers with a non-2xx response within the body cap: a transport failure, a body over the cap, and a 2xx response with a broken body all raise
AuthorizationErrorwithnilreaders. The section also leaves unsaid thatInvalidGrantErroris chosen on the rawerrorwhile theerrorreader holds the sanitized value, so a code the server padded,"invalid_grant\n"say, reads back aserror == "invalid_grant"yet raisesAuthorizationError; a reader inferring the class from the reader would get it wrong. The section now states the condition and the distinction.The sentence that other authorization failures have
nilreaders predates the authorization callback error of 1.7.0, which setserroranderror_descriptionwithhttp_statusleftnil; the section now says so. A blank diagnostic field reads asnilas well, since the sanitizer strips it; the section says so too.How Has This Been Tested?
Docs only. Both statements were checked against
token_endpoint_errorandbounded_requestinlib/mcp/client/oauth/flow.rb.The callback sentence was checked against
authorization_response_error.Breaking Changes
None.
Types of changes
Checklist