@@ -2024,6 +2024,84 @@ The client MUST handle access token refresh failures as follows:
20242024 - If the refresh fails due to a ` 4xx ` HTTP status code from the server, the
20252025 client should consider the session logged out.
20262026
2027+ #### Token revocation
2028+
2029+ When a user wants to log out from a client, the client SHOULD use OAuth 2.0
2030+ token revocation as defined in [ RFC 7009] ( https://datatracker.ietf.org/doc/html/rfc7009 ) .
2031+
2032+ The client makes a ` POST ` request to the ` revocation_endpoint ` that can be found
2033+ in the [ authorization server metadata] ( #server-metadata-discovery ) .
2034+
2035+ The body of the request includes the following parameters, encoded as
2036+ ` application/x-www-form-urlencoded ` :
2037+
2038+ <table >
2039+ <thead >
2040+ <tr>
2041+ <th>Parameter</th>
2042+ <th>Value</th>
2043+ </tr>
2044+ </thead >
2045+ <tbody >
2046+ <tr>
2047+ <td><code>token</code></td>
2048+ <td>
2049+ <strong>Required.</strong> MUST contain either the access token or the
2050+ refresh token to be revoked.
2051+ </td>
2052+ </tr>
2053+ <tr>
2054+ <td><code>token_type_hint</code></td>
2055+ <td>
2056+ <strong>Optional.</strong> If present, MUST have a value of either
2057+ <code>access_token</code> or <code>refresh_token</code>. The server MAY
2058+ use this value to optimize the token lookup process.
2059+ </td>
2060+ </tr>
2061+ <tr>
2062+ <td><code>client_id</code></td>
2063+ <td>
2064+ <p>
2065+ <strong>Optional.</strong> The client identifier obtained during
2066+ <a href="#client-registration">client registration</a>.
2067+ </p>
2068+ <p>
2069+ If the <code>client_id</code> is not provided, or does not match the
2070+ client associated with the token, the server SHOULD still revoke the
2071+ token. This behavior is meant to help good actors like secret scanning
2072+ tools to proactively revoke leaked tokens. The server MAY also warn
2073+ the user that one of their sessions may be compromised in this
2074+ scenario.
2075+ </p>
2076+ </td>
2077+ </tr>
2078+ </tbody >
2079+ </table >
2080+
2081+ For example, revoking using the access token:
2082+
2083+ ```
2084+ POST /oauth2/revoke HTTP/1.1
2085+ Host: auth.example.com
2086+ Content-Type: application/x-www-form-urlencoded
2087+
2088+ token=mat_ooreiPhei2wequu9fohkai3AeBaec9oo&
2089+ token_type_hint=access_token&
2090+ client_id=s6BhdRkqt3
2091+ ```
2092+
2093+ The server MUST revoke both the access token and refresh token associated with
2094+ the token provided in the request.
2095+
2096+ The server SHOULD return one of the following responses:
2097+
2098+ - If the token is already revoked or invalid, the server returns a ` 200 OK `
2099+ response
2100+ - If the client is not authorized to revoke the token, the server returns a
2101+ ` 401 Unauthorized ` response
2102+ - For other errors, the server returns a ` 400 Bad Request ` response with error
2103+ details
2104+
20272105### Account moderation
20282106
20292107#### Account locking
0 commit comments