Which characters may error_description contain in a token error response?
Token error_description limited to the allowed charactersRFC 6749 §5.2MUST NOTRoles: authorization_server
Requirement as recorded in the ProtocolSoup registry
Values for the "error_description" parameter MUST NOT include characters outside the set %x20-21 / %x23-5B / %x5D-7E.
Read §5.2 in RFC 6749Self-test verdict
PassCommit 00bac3fEvaluated
This is ProtocolSoup's result against its own implementation at the commit shown. It is not a certification of ProtocolSoup or of any other product.
Captured from production
Captured Commit 00bac3f
Captured from the deployed ProtocolSoup at the commit shown. Every request and response is shown exactly as sent and received.
Passing exchange
Not captured: The requirement constrains an error response, so every exchange that shows it is a refusal. The failing exchange is that response.
Failing exchange
Rejected, as requiredConformance client
The conformance client sends four token requests, each with a value that carries a double quote, a backslash or a non-ASCII character where the token endpoint might echo it: an unknown grant_type, an unknown client_id, a made-up authorization code and, as machine-client, an unregistered scope. In each error response, error and error_description stay within %x20-21 / %x23-5B / %x5D-7E and error_uri within %x21 / %x23-5B / %x5D-7E.
Requests from ProtocolSoup’s conformance client, which sends malformed messages on purpose. The hosted wallet never sends these.
1.POST https://protocolsoup.com/oauth2/token400 Bad Request
TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2
Request
POST /oauth2/token HTTP/2.0 Content-Length: 47 Content-Type: application/x-www-form-urlencoded Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1 client_id=public-app&grant_type=%22%C3%A9%22%5C
Response
HTTP/2.0 400 Bad Request Cache-Control: no-store Cf-Cache-Status: DYNAMIC Cf-Ray: a65bac12dd343cdb-MSP Content-Type: application/json Date: Sun, 06 Dec 2026 13:35:09 GMT Fly-Request-Id: 01M95S1HYNC1DYGDR3P6JAKWQN-ord Nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800} Pragma: no-cache Referrer-Policy: strict-origin-when-cross-origin Report-To: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=zTbciBM9msRDovBhFXIr2NE4%2Bk8eXuL7vZReX%2FfDZKvdmTXFVJsX9DF3DxgLVJKRSh4GLmRKeCAVq0h1%2BB7cNSYi4Zc8fwNab06JMkj4yywO3dYYGja%2BcnTejAWf8YHiA7I%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=3,cfOrigin;dur=201 Vary: Origin Vary: accept-encoding Via: 1.1 fly.io, 1.1 fly.io X-Content-Type-Options: nosniff X-Frame-Options: DENY X-Xss-Protection: 1; mode=block {"error":"unsupported_grant_type","error_description":"Grant type not supported","error_uri":"https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"}2.POST https://protocolsoup.com/oauth2/token400 Bad Request
TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2
Request
POST /oauth2/token HTTP/2.0 Content-Length: 62 Content-Type: application/x-www-form-urlencoded Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1 client_id=%22%C3%A9%22%5C&code=x&grant_type=authorization_code
Response
HTTP/2.0 400 Bad Request Cache-Control: no-store Cf-Cache-Status: DYNAMIC Cf-Ray: a65bac1919ec3cdb-MSP Content-Type: application/json Date: Sun, 06 Dec 2026 13:35:10 GMT Fly-Request-Id: 01M95S1JXY1Z5EAW7FVWRWCV0T-ord Nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800} Pragma: no-cache Referrer-Policy: strict-origin-when-cross-origin Report-To: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=WtH4nLSGIy8m4QJz0%2Fso2b19tQb9KPNekD%2FI3ksVmMiq1MvYmjlnkKe0uAOGjbx3V%2B%2Blj9SnHlAynUTDn%2FfOnQ2tlmUGeQ2aaksgEcgBh9k9nxVj3jAtLi3A8i8%2BMZvZwjQ%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=4,cfOrigin;dur=200 Vary: Origin Vary: accept-encoding Via: 1.1 fly.io, 1.1 fly.io X-Content-Type-Options: nosniff X-Frame-Options: DENY X-Xss-Protection: 1; mode=block {"error":"invalid_client","error_description":"Unknown client","error_uri":"https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"}3.POST https://protocolsoup.com/oauth2/token400 Bad Request
TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2
Request
POST /oauth2/token HTTP/2.0 Content-Length: 126 Content-Type: application/x-www-form-urlencoded Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1 client_id=public-app&code=%22%C3%A9%22%5C&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fprotocolsoup.com%2Fcallback
Response
HTTP/2.0 400 Bad Request Cache-Control: no-store Cf-Cache-Status: DYNAMIC Cf-Ray: a65bac1f5ff23cdb-MSP Content-Type: application/json Date: Sun, 06 Dec 2026 13:35:11 GMT Fly-Request-Id: 01M95S1KX46VZ6628FC9XDRRB3-ord Nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800} Pragma: no-cache Referrer-Policy: strict-origin-when-cross-origin Report-To: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=QcalJHwDOK9YlhNRyamKaF52S7BjgZZjBM2qXHHW6ihMQkRwNLtcMXV5NYpCviO0klEnhWlQd0B6Xqr4Qw%2BFDQHiTlUoPG%2B8T6lijr2fsGtKNWMIJJ%2FMr18hDMDVfnziQHI%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=2,cfOrigin;dur=201 Vary: Origin Vary: accept-encoding Via: 1.1 fly.io, 1.1 fly.io X-Content-Type-Options: nosniff X-Frame-Options: DENY X-Xss-Protection: 1; mode=block {"error":"invalid_grant","error_description":"invalid authorization code","error_uri":"https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"}4.POST https://protocolsoup.com/oauth2/token400 Bad Request
TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2
Request
POST /oauth2/token HTTP/2.0 Authorization: Basic bWFjaGluZS1jbGllbnQ6TTdCa0JKX2lLOEdwNFJlRjFTdkdDcWx1eE1uMnlTcnU= Content-Length: 51 Content-Type: application/x-www-form-urlencoded Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1 grant_type=client_credentials&scope=%22%C3%A9%22%5C
Response
HTTP/2.0 400 Bad Request Cache-Control: no-store Cf-Cache-Status: DYNAMIC Cf-Ray: a65bac259d963cdb-MSP Content-Type: application/json Date: Sun, 06 Dec 2026 13:35:12 GMT Fly-Request-Id: 01M95S1MWCHPFQPMQMSYY2ES3V-ord Nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800} Pragma: no-cache Referrer-Policy: strict-origin-when-cross-origin Report-To: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=IpTFQGX7NKquIWjoX8gWD0R8nUzL%2Bq1WPjlrlv6d8NAiGcu8LRg0pEl4wycIhWO3IRAmi%2FaQ4FXfHNjMu%2BcyjrKqlIR9R9pdwJ7KkZZqf0jvu3lAJOZkmvoo1%2BlIoE54mOs%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=3,cfOrigin;dur=200 Vary: Origin Vary: accept-encoding Via: 1.1 fly.io, 1.1 fly.io X-Content-Type-Options: nosniff X-Frame-Options: DENY X-Xss-Protection: 1; mode=block {"error":"invalid_scope","error_description":"None of the requested scopes are permitted for this client","error_uri":"https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"}
Tests
- TestTokenErrorParametersUseTheAllowedCharacters
./internal/protocols/oauth2
Pass
Implementation
Explainer
What this requires
error_description in a token error response may contain the same set as the error code: %x20-21 / %x23-5B / %x5D-7E, which is printable ASCII without the double quote and the backslash. error_description is optional. Section 5.2 calls it "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred."
Unlike the error code, a description is free text, and the natural way to write a helpful one is to mention what was wrong with the request. That is where the restriction bites. The description may not quote the offending value if the value can contain an excluded character, and request parameters can contain anything.
Why it exists
The description is for a developer, but it travels through code. It is a JSON string in a token error response, a query or fragment parameter in an authorization error response, and a quoted string in a WWW-Authenticate header at a resource server. Keeping it to plain ASCII without the two quoting characters means it survives all three unchanged. It also stops a caller from using the description to place chosen characters into a log line, a header or an error page.
What non-compliance looks like
A description assembled with the input inside it, in the form of unknown scope followed by the scope as received. Send a scope containing a double quote or a non-ASCII letter and the response violates the rule. Localized descriptions are the other common source.
How ProtocolSoup tests it
This server's descriptions are fixed strings that never include request data. A refused scope gets None of the requested scopes are permitted for this client, whatever was asked for. The trade-off is that the description names the kind of problem and not the value.
TestTokenErrorParametersUseTheAllowedCharacters puts a double quote, a backslash and a non-ASCII character into each value a description might echo, among them the grant type, client identifier, authorization code, redirect URI, code verifier, refresh token, scope, resource and DPoP header, and asserts every error_description stays within the set. The descriptions come from several packages, PKCE validation and resource indicators included.
Only a failing exchange is captured, because the requirement constrains an error response. error-parameters-of-refused-requests sends four hostile values and checks each description returned.