Proof Key for Code Exchange

Protects the authorization code grant from interception attacks using a cryptographic code verifier.

Sequence Diagram
1
Generate code_verifier and code_challenge
Client generates a cryptographically random code_verifier (RFC 7636 §4.1) and derives the code_challenge using S256: code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier))) (RFC 7636 §4.2).
Client App→Client App
2
Authorization Request with code_challenge
Client sends the Authorization Request (RFC 6749 §4.1.1) including code_challenge and code_challenge_method=S256 (RFC 7636 §4.3). The Authorization Server records these values with the issued authorization code (RFC 7636 §4.4).
Client App→IdP (Authorization Server)
3
Access Token Request with code_verifier
Client sends the Access Token Request (RFC 6749 §4.1.3) including code_verifier (RFC 7636 §4.5). The Authorization Server recomputes BASE64URL-ENCODE(SHA256(ASCII(code_verifier))) and compares it to the stored code_challenge to verify possession (RFC 7636 §4.6).
Client App→IdP (Authorization Server)