What happens when an authorization code is used more than once?

Authorization code used more than once is denied, its tokens revokedRFC 6749 §4.1.2MUSTRoles: authorization_server

Requirement as recorded in the ProtocolSoup registry

If an authorization code is used more than once, the authorization server MUST deny the request and SHOULD revoke (when possible) all tokens previously issued based on that authorization code.

Read §4.1.2 in RFC 6749

Self-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 and redeems the authorization code at the token endpoint within seconds of receiving 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. 1.GET https://protocolsoup.com/oauth2/authorize?client_id=public-app&redirect_uri=https%3A%2F%2Fprotocolsoup.com%2Fcallback&response_type=code&scope=profile&state=sHwNlJ9wf7Fefj6roLSf5w200 OK

    TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2

    Request

    GET /oauth2/authorize?client_id=public-app&redirect_uri=https%3A%2F%2Fprotocolsoup.com%2Fcallback&response_type=code&scope=profile&state=sHwNlJ9wf7Fefj6roLSf5w 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: a65ba8e019ec3cdb-MSP
    Content-Type: text/html
    Date: Sun, 06 Dec 2026 13:32:58 GMT
    Fly-Request-Id: 01M95RXJ0ZM5TS0SP68K9S0NSW-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=9vcbsLcmLnVygB%2BbwvtcMlN4qjcC6BW8d%2Bl4Bk9zJOcBZE%2FR5KVRhayqY22EraIbdZZZFw6OUveLa50ZmNiLY4KZVgbqUhGUds7GRSob01hkPyuCQ3ft9oQZOVgfWAX4L24%3D"}]}
    Server: cloudflare
    Server-Timing: cfCacheStatus;desc="DYNAMIC"
    Server-Timing: cfEdge;dur=5,cfOrigin;dur=198
    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="U1db2MAdg-yc2NbZOwO-wA">
                
                <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="caaba6a3a9af8aafb2aba7baa6afe4a9a5a7">[email&#160;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="5735383517322f363a273b327934383a">[email&#160;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="0263666f6b6c42677a636f726e672c616d6f">[email&#160;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:'a65ba8e019ec3cdb',t:'MTc5NjU2Mzk3OA=='};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=a65ba8e019ec3cdb',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. 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: 143
    Content-Type: application/x-www-form-urlencoded
    Host: protocolsoup.com
    User-Agent: ProtocolSoup-Conformance-Client/1
    
    client_id=public-app&code=_1reJrlEW0b5ckKXoTVHn5Jnf0DfEdGL&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: a65ba8f2da7f3cdb-MSP
    Content-Type: application/json
    Date: Sun, 06 Dec 2026 13:33:01 GMT
    Fly-Request-Id: 01M95RXMYQQNSZHM2K0TYT4EQ2-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=jdlrCcbmLMQGfJsACluPZc%2BaqTkuPgnrX26zTy1T548lt9MXlzXLIkH1wpO%2F%2FF94NekSdqe1tqdM%2BaGAsGbN9jFTQoS6qdQVDJbKaQHZn5mEOpfDH84d8VZ5Iy59ilj7Unk%3D"}]}
    Server: cloudflare
    Server-Timing: cfCacheStatus;desc="DYNAMIC"
    Server-Timing: cfEdge;dur=4,cfOrigin;dur=202
    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.eyJhdWQiOiJodHRwczovL3Byb3RvY29sc291cC5jb20vb2F1dGgyL3Jlc291cmNlIiwiYmlydGhkYXRlIjoiMTk5MC0wMy0xMiIsImNsaWVudF9pZCI6InB1YmxpYy1hcHAiLCJleHAiOjE3OTY1Njc1ODEsImZhbWlseV9uYW1lIjoiSm9obnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImdpdmVuX25hbWUiOiJBbGljZSIsImlhdCI6MTc5NjU2Mzk4MSwiaXNzIjoiaHR0cHM6Ly9wcm90b2NvbHNvdXAuY29tL29hdXRoMiIsImp0aSI6Imp0aS03YzIwMjllNDYzNmNiMTQxIiwibG9jYWxlIjoiZW4tQVUiLCJtaWRkbGVf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ZSIsInN1YiI6ImFsaWNlIiwidHlwZSI6InJlZnJlc2gifQ.bTyNQKN_hInTreoVqI9nSqV-DIGnzSWTtcB29Q92IWfL3djDhB2yBWlPdxGPRaQu5j4FRkIywqvLeDHj6Gh8jd6RYDkXo54MzK4iNJcP2YsCgDzP7rxlJCua85YZRoh0nrtJ0thzpOlVP8u5Ij18hC9jPKI1ougkzZWJKJljrDD08Usn5kvVW6MP4SQKilYdb9IET1jt1A8esnCGMMQa5ASmeGPxmw0v3qNu9cuLvM3hN0zv7GKm47aLpFNE2nGKZWve5x9AmB09MWafMssh77cURS2Kmx9LzLw0c7dcTmhmdYpfwFcANUe8DSITyi9iH74SO_ir0SwyUxXqfuQTwg","scope":"profile"}
    

Failing exchange

Rejected, as requiredConformance client

The conformance client obtains an authorization code as public-app, redeems it, and sends the same token request again. The second request is denied with invalid_grant. The client then presents the access token the first request issued to GET /oauth2/resource: the replay revoked it, and the resource answers 401 invalid_token.

Requests from ProtocolSoup’s conformance client, which sends malformed messages on purpose. The hosted wallet never sends these.

  1. 1.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: 143
    Content-Type: application/x-www-form-urlencoded
    Host: protocolsoup.com
    User-Agent: ProtocolSoup-Conformance-Client/1
    
    client_id=public-app&code=mFUYlodGqID2ssT3iH56xuI_sZU1ng0c&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: a65ba9121e373cdb-MSP
    Content-Type: application/json
    Date: Sun, 06 Dec 2026 13:33:06 GMT
    Fly-Request-Id: 01M95RXSTY04MQ4NKMPZTW0CEE-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=m0fl0KQsI58liliwdl1ZmRL5a4oirSoxyo6nGF0eBJaSU7xQ8LdFerItggCicZldTPKjKeSrhBsYpEVq%2Fzo5Y6TrLvSJPnjgPxR3Jp2L2QfBMs9QUY%2BmFJhMkzQ4KvPnKSs%3D"}]}
    Server: cloudflare
    Server-Timing: cfCacheStatus;desc="DYNAMIC"
    Server-Timing: cfEdge;dur=3,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
    
    {"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6InJzYS05YTJlNThlYzVjNjk3NGJmIiwidHlwIjoiYXQrand0In0.eyJhdWQiOiJodHRwczovL3Byb3RvY29sc291cC5jb20vb2F1dGgyL3Jlc291cmNlIiwiYmlydGhkYXRlIjoiMTk5MC0wMy0xMiIsImNsaWVudF9pZCI6InB1YmxpYy1hcHAiLCJleHAiOjE3OTY1Njc1ODYsImZhbWlseV9uYW1lIjoiSm9obnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImdpdmVuX25hbWUiOiJBbGljZSIsImlhdCI6MTc5NjU2Mzk4NiwiaXNzIjoiaHR0cHM6Ly9wcm90b2NvbHNvdXAuY29tL29hdXRoMiIsImp0aSI6Imp0aS1lOTk0NWI4NDUzMTg0ZDcxIiwibG9jYWxlIjoiZW4tQVUiLCJtaWRkbGVfbmFtZSI6Ik1hcmllIiwibmFtZSI6IkFsaWNlIEpvaG5zb24iLCJuYmYiOjE3OTY1NjM5ODYsIm5pY2tuYW1lIjoiQWxpIiwicGljdHVyZSI6Imh0dHBzOi8vd3d3LnByb3RvY29sc291cC5jb20vdS9hbGljZS9hdmF0YXIucG5nIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWxpY2UiLCJwcm9maWxlIjoiaHR0cHM6Ly93d3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2UmntrrBpUymy0foi6grdMrgVqye8gU4RbcXCVGsxMq3v7Dp79XMlpimLIKTQTgkBP6c_6mowgwJSrgjCggxlZau0Kev21rPGSVeXwUHrLnD3zEfYJT134Ucl_hCcQX6KYjVvODoM5D3FWYPp3ezU3kSeeovR7sVnt3OTdEaR0g","scope":"profile"}
    
  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: 143
    Content-Type: application/x-www-form-urlencoded
    Host: protocolsoup.com
    User-Agent: ProtocolSoup-Conformance-Client/1
    
    client_id=public-app&code=mFUYlodGqID2ssT3iH56xuI_sZU1ng0c&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: a65ba9185c733cdb-MSP
    Content-Type: application/json
    Date: Sun, 06 Dec 2026 13:33:07 GMT
    Fly-Request-Id: 01M95RXTV13F38QZ7CZV8KXC52-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=3syWpUMe6pwlf4lzm%2F9W%2BizH3taGDNdEjuD3BSj1HGKZzdz6Tu1DKJh9qMiDUZNGy362EaEhEUE34pj6U8YPYa5z5rpiQXn0rYatlJmyUxR1MWWqTe0PpI0DdJwQRGfA1L4%3D"}]}
    Server: cloudflare
    Server-Timing: cfCacheStatus;desc="DYNAMIC"
    Server-Timing: cfEdge;dur=4,cfOrigin;dur=233
    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":"authorization code already used","error_uri":"https://datatracker.ietf.org/doc/html/rfc6749#section-5.2"}
    
  3. 3.GET https://protocolsoup.com/oauth2/resource401 Unauthorized

    TLS: TLS 1.3 · TLS_AES_128_GCM_SHA256 · h2

    Request

    GET /oauth2/resource HTTP/2.0
    Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InJzYS05YTJlNThlYzVjNjk3NGJmIiwidHlwIjoiYXQrand0In0.eyJhdWQiOiJodHRwczovL3Byb3RvY29sc291cC5jb20vb2F1dGgyL3Jlc291cmNlIiwiYmlydGhkYXRlIjoiMTk5MC0wMy0xMiIsImNsaWVudF9pZCI6InB1YmxpYy1hcHAiLCJleHAiOjE3OTY1Njc1ODYsImZhbWlseV9uYW1lIjoiSm9obnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImdpdmVuX25hbWUiOiJBbGljZSIsImlhdCI6MTc5NjU2Mzk4NiwiaXNzIjoiaHR0cHM6Ly9wcm90b2NvbHNvdXAuY29tL29hdXRoMiIsImp0aSI6Imp0aS1lOTk0NWI4NDUzMTg0ZDcxIiwibG9jYWxlIjoiZW4tQVUiLCJtaWRkbGVfbmFtZSI6Ik1hcmllIiwibmFtZSI6IkFsaWNlIEpvaG5zb24iLCJuYmYiOjE3OTY1NjM5ODYsIm5pY2tuYW1lIjoiQWxpIiwicGljdHVyZSI6Imh0dHBzOi8vd3d3LnByb3RvY29sc291cC5jb20vdS9hbGljZS9hdmF0YXIucG5nIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWxpY2UiLCJwcm9maWxlIjoiaHR0cHM6Ly93d3cucHJvdG9jb2xzb3VwLmNvbS91L2FsaWNlIiwic2NvcGUiOiJwcm9maWxlIiwic3ViIjoiYWxpY2UiLCJ1cGRhdGVkX2F0IjoxNzk2NTYyNjkzLCJ3ZWJzaXRlIjoiaHR0cHM6Ly9hbGljZS5leGFtcGxlLmNvbSIsInpvbmVpbmZvIjoiQXVzdHJhbGlhL1N5ZG5leSJ9.Kvt6OAVj5caBHRNpwpaTZ9G9JQPDGj27QqPohFZ_yYX0Aqlm2-Rm7-6qZQ9oMuaPsG8CryN43SR3SsRX6uMa0ZfDd4CHOv6L--kuyzkkhWFS0_26blZC6W_8xC4oVZup0blTqzLnb-0hrIqx4ZQJeGlk-AO9VjlQjkJ926iDxvNbgTIhAukaZvMQ-8dXuu_6zzyrqKu5rmAG8gPCs4Xw_ina_Q_QC9Q6b-cfj_9hzuStcEoyU_sf9-VNBLX_m1MzSZ3h1qhElohSS9xRG6Ftvs0yqQ5QYRHaJ9lvaLabjeWd3-o9JCqz6kFscbmwxrPehwnvhxWp5jHm4dUIJ7N-6A
    Host: protocolsoup.com
    User-Agent: ProtocolSoup-Conformance-Client/1
    
    

    Response

    HTTP/2.0 401 Unauthorized
    Cache-Control: no-store
    Cf-Cache-Status: DYNAMIC
    Cf-Ray: a65ba91e98833cdb-MSP
    Content-Type: application/json
    Date: Sun, 06 Dec 2026 13:33:08 GMT
    Fly-Request-Id: 01M95RXVSE47Y5EZ4TZM9QEYCG-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=p1lyz266%2BMWR6IxSMZLdV5yW9MRvnpQSPTU6Xt8lMeoclqp6fn7BbPPDepntMvtz8XODNFNmTR43axaWyBiSP8LQj8mrOv4AGpE8zlqtm29TxQQuKnz2jCweZ4lzSlRqKUU%3D"}]}
    Server: cloudflare
    Server-Timing: cfCacheStatus;desc="DYNAMIC"
    Server-Timing: cfEdge;dur=3,cfOrigin;dur=206
    Speculation-Rules: "/cdn-cgi/speculation"
    Vary: Origin
    Vary: accept-encoding
    Via: 1.1 fly.io, 1.1 fly.io
    Www-Authenticate: Bearer error="invalid_token"
    X-Content-Type-Options: nosniff
    X-Frame-Options: DENY
    X-Xss-Protection: 1; mode=block
    
    {"error":"invalid_token","error_description":"access token has been revoked"}
    

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 Glass

Tests

Implementation

Explainer

What this requires

When an authorization code is used more than once, the second request is denied, and the tokens the first request produced should be revoked. The sentence has a MUST and a SHOULD. Denying the reuse is mandatory. Revoking "(when possible) all tokens previously issued based on that authorization code" is the recommended second half, and it is what makes the detection worth something.

To do either, the server has to remember codes after they are redeemed, at least for as long as the tokens issued from them could still be valid, and it has to know which tokens came from which code.

Why it exists

A code presented twice means two parties had it. One is the client. The other got it from somewhere it should not have been, and the server cannot tell which of the two arrived first. If the attacker was first, the legitimate client's later attempt is the only signal the server will ever get, and the tokens to worry about are the ones already issued. Revoking them ends the attacker's access at the moment the theft becomes detectable.

What non-compliance looks like

A server that deletes a code on redemption and afterwards cannot tell a replay from a string it never issued. It answers invalid_grant both times and revokes nothing, so a thief who won the race keeps working tokens.

Revoking only the access token is a partial fix. If the refresh token survives, so does the access.

How ProtocolSoup tests it

The Mock IdP keeps a record of each redeemed code with the identifiers of the access tokens issued from it, and each refresh token remembers its code through every rotation. A replay is answered 400 with error invalid_grant and error_description authorization code already used, the access tokens are revoked by jti, and the grant's refresh token is deleted.

TestAuthorizationCodeReplayRevokesRefreshedTokens redeems a code, refreshes once, and then presents the code again. The replay is refused. Both access tokens, the original and the refreshed one, are revoked, and the current refresh token no longer exists. Tokens from a different code are untouched. The Looking Glass event Authorization Code Replayed: Tokens Revoked lists the revoked jti values.

The captured passing exchange is code-redeemed-at-once. The failing one, code-used-twice, redeems a code, replays it, and then presents the first access token to /oauth2/resource, which answers 401 invalid_token with access token has been revoked.

Related requirements

All RFC 6749 requirements · OAuth 2.0 protocol page