Proof Key for Code Exchange (PKCE, pronounced “pixy”) strengthens the OAuth authorization code flow when an attacker might steal client credentials or an authorization code. It binds the token request to the same client that initiated user authentication. section 13.3.2
Apply PKCE across two authorization-code steps:
- Generate a random value called the verifier. section 13.3.2
- Hash the verifier to produce the challenge, then send the challenge with the user-login request. section 13.3.2
- Send the verifier when requesting the access token; the authorization server compares it with the stored challenge. section 13.3.2
- Reject the exchange when the verifier does not match, preventing a stolen authorization code alone from producing an access token. section 13.3.2
verifier = random(); challenge = hash(verifier);
A compact pseudocode listing captures the essential relationship: the client sends the hash-derived challenge first and the verifier later. section 13.3.2




