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 f8fbeb7
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/_client/authorization.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -268,18 +268,22 @@ so the storage should expire entries older than `pending_authorization_max_age`,
268
268
269
269
### Token Endpoint Errors
270
270
271
-
When a token exchange or refresh fails, `MCP::Client::OAuth::Flow::AuthorizationError` includes the HTTP status and
272
-
the authorization server's `error` and `error_description` from [RFC 6749 Section 5.2](https://www.rfc-editor.org/rfc/rfc6749#section-5.2).
271
+
When the token endpoint answers a token exchange or refresh with a non-2xx response within the body cap,
272
+
`MCP::Client::OAuth::Flow::AuthorizationError` includes the HTTP status and the authorization server's `error`
273
+
and `error_description` from [RFC 6749 Section 5.2](https://www.rfc-editor.org/rfc/rfc6749#section-5.2).
273
274
For example:
274
275
275
276
```text
276
277
Token endpoint returned status 400. invalid_request: Client must not use multiple authentication methods
277
278
```
278
279
279
280
The exception exposes `http_status`, `error`, and `error_description` readers for structured diagnostics. Missing or non-string
280
-
diagnostic fields are `nil`; non-JSON responses retain the status-only message. Other authorization failures have `nil` readers.
281
-
An `invalid_grant` response still raises `Flow::InvalidGrantError`, a subclass of `Flow::AuthorizationError`, so refresh-token
282
-
recovery behavior is unchanged.
281
+
diagnostic fields are `nil`, as are blank ones; non-JSON responses retain the status-only message.
282
+
When the authorization server returns an error to the authorization callback ([RFC 6749 Section 4.1.2.1](https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2.1)),
283
+
`error` and `error_description` are set the same way, with `http_status` left `nil`; other authorization failures have `nil` readers.
284
+
A token endpoint response whose raw `error` is exactly `invalid_grant` still raises `Flow::InvalidGrantError`, a subclass of
285
+
`Flow::AuthorizationError`, so refresh-token recovery behavior is unchanged. The class follows the raw value
286
+
while the `error` reader holds the sanitized one, so `error == "invalid_grant"` alone does not imply that class.
283
287
284
288
Diagnostic fields are limited to 128 characters for `error` and 512 for `error_description`, including a trailing `...` when
285
289
truncated. Characters outside the RFC's printable ASCII set are replaced with spaces, and surrounding whitespace is removed.
0 commit comments