PKCE
Short for Proof Key for Code Exchange: the client sends a hash of a random secret at the start of the flow and the secret itself when exchanging the code.
In more detail
An attacker who intercepts the code cannot exchange it without the secret. It is required for public clients and recommended for all.
Related terms
- authorization code flow — The OAuth flow in which the browser brings back a short-lived code that the client then exchanges directly with the authorization server for tokens.
- OAuth client — In OAuth, the application that asks for and uses an access token to call an API on a user’s behalf.
- SHA-256 — A widely used hash function that turns any data into a 256-bit fingerprint, shown as 64 hexadecimal characters.
- Base64 — A way to write any bytes using only 64 safe text characters, so binary data can travel in places that expect text.
- entropy — A measure of how unpredictable a value is; high-entropy secrets are long and truly random so they cannot be guessed.
Taught in
- Remote Servers And Trust — AI Engineering: LLM Apps, RAG & Agents
- OAuth Two And OpenID Connect — Modern API Architecture: REST, GraphQL & gRPC
- Session Architecture: HTTP-Only Cookies vs Tokens — Production Full-Stack Engineering
- OAuth2 & OpenID Connect: Social Auth & PKCE Flows — Production Full-Stack Engineering
References
- RFC 7636: Proof Key for Code Exchange (PKCE)
- RFC 9700: Best Current Practice for OAuth 2.0 Security
- OAuth.net: PKCE