Visual RFC.
ALL RFCs / RFC 9700
Read the RFC ↗
RFC 9700 / THE FOUNDATIONS

Authorization code + PKCE

02

Proof Key for Code Exchange (PKCE) lets an app prove that it started the request. A stolen authorization code alone is not enough.

RFC 9700 · § 2.1.1EXAMPLE
4 / 4
04
Only a matching exchange succeeds.

Knowing the code alone does not provide the verifier needed to redeem it.

Authorization code + PKCEProof Key for Code Exchange (PKCE) lets an app prove that it started the request. A stolen authorization code alone is not enough. Current state: Only a matching exchange succeeds..Authorization code + PKCEClientAuthorization serverfresh secret1 · derived challenge2 · authorization code Ccode C · saved challengemethod: S2563 · code C + secretToken endpointS256(secret) matches4 · access token TClient holds token T

Key idea: Bind the code to this transaction.

Terms
App / client
The software asking for permission to use your data.
Verifier and challenge
The verifier is a fresh secret kept by the app. The challenge is a value derived from it, sent before the code is issued.
S256
A method that hashes the verifier with SHA-256 and base64url-encodes the result. This is not encryption; the server later repeats the calculation.
Public and confidential clients
A public client cannot keep an app credential secret, for example code installed on a user device. A confidential client can protect its credentials, for example on its own server.
OIDC and nonce
OpenID Connect (OIDC) adds sign-in identity to OAuth. Its nonce is a fresh value binding the sign-in response to the request; the alternative below has additional conditions.
What PKCE proves
It binds a code exchange to the transaction that kept the verifier. It is separate from proving the app identity, and does not encrypt the code.

Look up a term in the glossary ↗

Rules & examples
  • Public clients MUST use PKCE; confidential clients are RECOMMENDED to use it. Authorization servers MUST support it.
  • Use a fresh, session-bound challenge. Clients SHOULD use a method that hides the verifier; S256 is the available method named here.
  • The token endpoint MUST check the verifier when a challenge was supplied. Confidential OIDC clients may instead use nonce with the precautions in § 4.5.3.2.

PKCE is for web apps too. It is separate from client authentication: proving which app you are does not prove which user transaction a code belongs to.

Sources
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

A key is different from permission.

An app, a person, and a server have different roles. Follow who asks, who grants permission, and who checks the credential. A key in the drawing is an analogy, not a literal protocol field.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

What changed
RFC 6749 § 4.1RFC 9700 § 2.1.1

The framework did not require PKCE. Public clients now MUST use it; confidential clients are RECOMMENDED to use it. Servers MUST support PKCE, enforce the verifier, and prevent downgrade.

Read the updated RFC section ↗

All chapters in RFC 9700

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗