Which code challenge method does the token endpoint use to verify the code_verifier?
code_verifier verified with the method bound to the authorization codeRFC 7636 §4.5MUSTRoles: authorization_server
Requirement as recorded in the ProtocolSoup registry
That is the method that the token endpoint MUST use to verify the "code_verifier".
Read §4.5 in RFC 7636Self-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
Accepted, as requiredConformance client
The conformance client sends public-app's authorization request with the code_challenge of RFC 7636 Appendix B and code_challenge_method=S256, and redeems the code with the Appendix B code_verifier. S256 is the method bound to the code, and the token endpoint uses it. The sign-in between the two requests is not recorded.
Requests from ProtocolSoup’s conformance client, which sends malformed messages on purpose. The hosted wallet never sends these.
1.GET https://protocolsoup.com/oauth2/authorize?client_id=public-app&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fprotocolsoup.com%2Fcallback&response_type=code&scope=profile&state=c0Z65oH4qDaz0z3O0GldtQ200 OK
TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2
Request
GET /oauth2/authorize?client_id=public-app&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fprotocolsoup.com%2Fcallback&response_type=code&scope=profile&state=c0Z65oH4qDaz0z3O0GldtQ HTTP/2.0 Accept: text/html Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1
Response
HTTP/2.0 200 OK Cf-Cache-Status: DYNAMIC Cf-Ray: a65bb077de523cdb-MSP Content-Type: text/html Date: Sun, 06 Dec 2026 13:38:09 GMT Fly-Request-Id: 01M95S71RWEB81VXAWQNVE9M9P-ord Nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800} 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=VNcly9D1v2oeeG3%2BcS360VUMBPaFfJ5OVT69e2Bv%2BMQwUS3z31lXWur4MtynB9eQfaYN5Bb19yUhO3lJXJlqC53CqxdloVGYt4%2FI%2Bzt4JfJWpcxIF18wzp%2FUEP3h%2FPa8BHE%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=3,cfOrigin;dur=241 Speculation-Rules: "/cdn-cgi/speculation" 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 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>Login - Protocol Showcase</title> <style> * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Segoe UI', system-ui, sans-serif; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; color: #e4e4e7; padding: 16px; } .container { background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); } @media (min-width: 480px) { body { padding: 0; } .container { padding: 40px; } } .logo { text-align: center; margin-bottom: 30px; } .logo h1 { font-size: 24px; font-weight: 600; color: #fff; } .logo p { color: #a1a1aa; font-size: 14px; margin-top: 8px; } .client-info { background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.2); border-radius: 8px; padding: 16px; margin-bottom: 24px; text-align: center; } .client-info span { color: #a5b4fc; font-size: 14px; } .client-info strong { color: #fff; } .form-group { margin-bottom: 20px; } label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: #d4d4d8; } input[type="email"], input[type="password"], input[type="text"] { width: 100%; padding: 12px 16px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; background: rgba(0, 0, 0, 0.2); color: #fff; font-size: 16px; transition: all 0.2s; } input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); } button { width: 100%; padding: 14px; background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); border: none; border-radius: 8px; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; } button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.5); } .error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #fca5a5; padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; } .demo-users { margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, 0.1); } .demo-users h3 { font-size: 14px; color: #a1a1aa; margin-bottom: 12px; } .demo-user { background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.2s; } .demo-user:hover { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.2); } .demo-user .name { font-weight: 500; color: #fff; } .demo-user .email { font-size: 12px; color: #71717a; } .scopes { margin-top: 16px; font-size: 12px; color: #71717a; } .scopes span { display: inline-block; background: rgba(99, 102, 241, 0.1); padding: 4px 8px; border-radius: 4px; margin: 2px; } </style> </head> <body> <div class="container"> <div class="logo"> <h1>Protocol Showcase</h1> <p>OAuth 2.0 Authorization</p> </div> <div class="client-info"> <span>Signing in to <strong>Public Application (SPA)</strong></span> </div> <!-- ERROR --> <form method="POST" action="/oauth2/authorize"> <input type="hidden" name="login_request_id" value="OzzlmtcnEdSKAveJYn5D8w"> <div class="form-group"> <label for="email">Email</label> <input type="email" id="email" name="email" placeholder="[email protected]" required> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" id="password" name="password" placeholder="password" required> </div> <button type="submit">Sign In</button> </form> <div class="demo-users"><h3>Demo Users (click to autofill)</h3><div class="demo-user" data-email="[email protected]" data-password="4bbw3nqtTsR9az7s2albdeeu" onclick="fillCredentials(this.dataset.email || '', this.dataset.password || '')"><div class="name">Alice (Standard User)</div><div class="email"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="26474a4f454366435e474b564a430845494b">[email protected]</a></div></div><div class="demo-user" data-email="[email protected]" data-password="6PdvnYFdfrvoyxTXbzmHF9c1" onclick="fillCredentials(this.dataset.email || '', this.dataset.password || '')"><div class="name">Bob (Standard User)</div><div class="email"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5634393416332e373b263a337835393b">[email protected]</a></div></div><div class="demo-user" data-email="[email protected]" data-password="ETi7vCbBBwojO-wKkmBZp81Q" onclick="fillCredentials(this.dataset.email || '', this.dataset.password || '')"><div class="name">Admin (Elevated Permissions)</div><div class="email"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="056461686c6b45607d64687569602b666a68">[email protected]</a></div></div></div> <div class="scopes"> Requested scopes: <span>profile</span> </div> </div> <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script> function fillCredentials(email, password) { document.getElementById('email').value = email; document.getElementById('password').value = password; } </script> <script>(function(){function c(){var b=a.contentDocument||(a.contentWindow&&a.contentWindow.document);if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a65bb077de523cdb',t:'MTc5NjU2NDI4OQ=='};var l=window.parent.location,o;try{o=new URL(l.origin).origin}catch(e){try{o=new URL(new URL(l.href).origin).origin}catch(e){o=''}}var u='/cdn-cgi/challenge-platform/scripts/jsd/main.js?ray=a65bb077de523cdb',a=document.createElement('script');a.src=o?new URL(u,o).href:u;document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script><script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/vce701823e78c4301a35b7e07294d87301792088814092" integrity="sha512-UKNk8GbxkABxKcXYuLkO16EleLGUkcvJWtpSNmExE0Too3ZaFAxTscNWEc1OdAv5/BikHawapSCaiD2XCmp+Bw==" data-cf-beacon='{"version":"2024.11.0","token":"4e68ea7d404d48c4b57e5a383f411883","spa":2}' crossorigin="anonymous"></script> </body> </html>2.POST https://protocolsoup.com/oauth2/token200 OK
TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2
Request
POST /oauth2/token HTTP/2.0 Content-Length: 201 Content-Type: application/x-www-form-urlencoded Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1 client_id=public-app&code=tJs9m3CSZFkMmsaXg5xKErQVgsij-O9_&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fprotocolsoup.com%2Fcallback
Response
HTTP/2.0 200 OK Cache-Control: no-store Cf-Cache-Status: DYNAMIC Cf-Ray: a65bb08a9f7a3cdb-MSP Content-Type: application/json Date: Sun, 06 Dec 2026 13:38:12 GMT Fly-Request-Id: 01M95S74NCDX326GQH0GAER08M-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=50CZwouFxLPHpR5yVo8FlqdUMnYxL8IoxZXEjun0wrGjlh0e5%2F9E1tEWa2PgZUFTNFOkHDqv6qaBhvFoL%2B%2BdCA1O%2FNbll4sue1YciZRJyHTdQ%2BKZC01RCDHE4zkHqHzmjZ0%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=3,cfOrigin;dur=207 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 {"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6InJzYS05YTJlNThlYzVjNjk3NGJmIiwidHlwIjoiYXQrand0In0.eyJhdWQiOiJodHRwczovL3Byb3RvY29sc291cC5jb20vb2F1dGgyL3Jlc291cmNlIiwiYmlydGhkYXRlIjoiMTk5MC0wMy0xMiIsImNsaWVudF9pZCI6InB1YmxpYy1hcHAiLCJleHAiOjE3OTY1Njc4OTIsImZhbWlseV9uYW1lIjoiSm9obnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImdpdmVuX25hbWUiOiJBbGljZSIsImlhdCI6MTc5NjU2NDI5MiwiaXNzIjoiaHR0cHM6Ly9wcm90b2NvbHNvdXAuY29tL29hdXRoMiIsImp0aSI6Imp0aS04MmVhZWMyMDA4OGNhZGY4IiwibG9jYWxlIjoiZW4tQVUiLCJtaWRkbGVfbmFtZSI6Ik1hcmllIiwibmFtZSI6IkFsaWNlIEpvaG5zb24iLCJuYmYiOjE3OTY1NjQyOTIsIm5pY2tuYW1lIjoiQWxpIiwicGljdHVyZSI6Imh0dHBzOi8vd3d3LnByb3RvY29sc291cC5jb20vdS9hbGljZS9hdmF0YXIucG5nIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWxpY2UiLCJwcm9maWxlIjoiaHR0cHM6Ly93d3cucHJvdG9jb2xzb3VwLmNvbS91L2FsaWNlIiwic2NvcGUiOiJwcm9maWxlIiwic3ViIjoiYWxpY2UiLCJ1cGRhdGVkX2F0IjoxNzk2NTYyNjkzLCJ3ZWJzaXRlIjoiaHR0cHM6Ly9hbGlj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S3-QeFk-xLxMMxo7RTevA","scope":"profile"}
Failing exchange
Rejected, as requiredConformance client
The conformance client obtains an authorization code as public-app with an S256 code_challenge, then sends the token request with a code_verifier equal to the code_challenge itself. That value would satisfy the plain comparison; the method bound to the code is S256, and under it the values differ.
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: 201 Content-Type: application/x-www-form-urlencoded Host: protocolsoup.com User-Agent: ProtocolSoup-Conformance-Client/1 client_id=public-app&code=aiCCZtqCKL3pMZ7r62li1OXF9-kolkIa&code_verifier=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&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: a65bb0a9d91c3cdb-MSP Content-Type: application/json Date: Sun, 06 Dec 2026 13:38:17 GMT Fly-Request-Id: 01M95S79HMNF2333D1ZXBRBCSK-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=2KX0YkFhWkeSTuOO8g0lMa5RRoOzqYXHglXPcJ6rYGHgpywaWRVW82uLa7egcxOBF9ytJktE20V1wrGLzKuqtZ7421nnuRQabUELGQ8YkV6luae0iBhbyzACDeoDvvYo6p4%3D"}]} Server: cloudflare Server-Timing: cfCacheStatus;desc="DYNAMIC" Server-Timing: cfEdge;dur=4,cfOrigin;dur=211 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":"code_verifier does not match code_challenge (RFC 7636 Section 4.6)","error_uri":"https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"}
Run it live
Looking Glass runs the flow that sends the message this requirement governs, against the same server, and decodes each exchange as it happens.
Open the flow in Looking GlassTests
- TestCodeVerifierIsVerifiedWithTheMethodBoundToTheCode
./internal/protocols/oauth2
Pass - TestPKCEVerifiesS256AndNothingElse
./internal/mockidp
Pass
Implementation
Explainer
What this requires
The token endpoint uses the method that was bound to the authorization code when the code was issued. RFC 7636 Section 4.5 states the binding in the sentence before the requirement: "The "code_challenge_method" is bound to the Authorization Code when the Authorization Code is issued." The method is part of what the user's authorization fixed, like the client and the redirection URI.
It follows that nothing in the token request can change it. The token request has no code_challenge_method parameter, and a server must not invent one, infer the method from the shape of the verifier, or try both comparisons and accept whichever passes.
Why it exists
The two transformations give different answers for the same input. Under plain, Section 4.6 compares "code_verifier == code_challenge"; under S256 it hashes the verifier first. An attacker who has seen an S256 challenge in the authorization request holds exactly the value that passes the plain comparison. A token endpoint that could be talked into plain would accept the challenge as its own verifier, and the hash would protect nothing.
What non-compliance looks like
The tell is a token request whose code_verifier equals the code_challenge succeeding for a code issued under S256. It also shows up as a server that reads code_challenge_method from the token request body.
Here that request is refused. /oauth2/token answers 400 invalid_grant with code_verifier does not match code_challenge (RFC 7636 Section 4.6). A code_challenge_method=plain added to the token request changes nothing, because the endpoint ignores parameters it does not recognize.
How ProtocolSoup tests it
The Mock IdP reads the method from the code's own record. TestCodeVerifierIsVerifiedWithTheMethodBoundToTheCode obtains a code bound to S256, presents the challenge itself as the verifier and expects invalid_grant, repeats that with code_challenge_method=plain in the token request and expects the same, and then redeems the code with the real verifier. TestPKCEVerifiesS256AndNothingElse covers the verification function directly.
The captured passing exchange is verified-with-s256. The failing one, code-verifier-equal-to-the-code-challenge, sends the challenge as the verifier.