Skip to content

Commit 311da11

Browse files
committed
docs: more detailed PKCE instructions
1 parent 873f72c commit 311da11

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎docs/oauth2/specs/rfc7636.rst‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,20 @@ Now you can register your ``AuthorizationCodeGrant`` with the extension::
113113
from authlib.oauth2.rfc7636 import CodeChallenge
114114
server.register_grant(MyAuthorizationCodeGrant, [CodeChallenge(required=True)])
115115

116-
If ``required=True``, code challenge is required for authorization code flow from public clients.
117-
If ``required=False``, it is optional, it will only valid the code challenge
118-
when clients send these parameters.
116+
With ``required=True``, public clients must use PKCE. The check happens at
117+
the token endpoint: a public client that sends no ``code_verifier`` gets an
118+
``invalid_request`` error. The authorization endpoint does not reject a request
119+
without ``code_challenge``, but the code it returns cannot be exchanged.
120+
121+
With ``required=False``, PKCE is optional for all clients.
122+
123+
In both modes:
124+
125+
* If the authorization request contained a ``code_challenge``, the token
126+
request must contain a matching ``code_verifier``.
127+
* If the authorization request contained no ``code_challenge``, a token
128+
request with a ``code_verifier`` is rejected.
129+
* Confidential clients may use PKCE, but are not required to.
119130

120131
Using ``code_challenge`` in Client
121132
----------------------------------

0 commit comments

Comments
 (0)