liveBook · Manning

Proof Key for Code Exchange

As explained in Grokking Software Architecture

PKCE is an OAuth 2.0 security extension that binds an authorization request to a client-generated code verifier to protect public clients from intercepted authorization codes.

PKCE is an OAuth 2.0 security extension for public clients, such as mobile and single-page web apps, which cannot safely store a permanent client secret. For each login, the client creates a temporary code verifier and a code challenge. If an app intercepts the authorization code, it cannot use it without the verifier—the puzzle’s solution. section 11.3.2

A user login

A person logging into a mobile or web app uses the Authorization Code Flow with PKCE. If another app intercepts the temporary login code, the verifier prevents that code from being useful on its own. section 11.3.2

Table 11.1 Selecting the Correct OAuth 2.0 Flow by Architectural Scenario
Scenario
Recommended OAuth 2.0 Flow
Key Characteristic
Human User logging into a web or mobile app.
Authorization Code Flow (with PKCE)
Redirects the user to a secure login page hosted by the IdP.
Backend Service talking to another service (Machine-to-Machine).
Client Credentials Flow
No humans are involved; the service uses its own ID and Secret to obtain a token.

Compare when to use the Authorization Code Flow with PKCE versus the Client Credentials Flow. section 11.3.2

How Grokking Software Architecture covers it

How deep it goes
Explains the temporary challenge and verifier protection, but does not detail their generation or implementation.
Examples
Uses mobile and single-page app logins and an intercepted authorization code to illustrate the protection.
What you can do after
Understand why an intercepted authorization code remains unusable without the client’s verifier.
How it connects
Connects OAuth 2.0, OpenID Connect, public clients, and the Authorization Code Flow.

Also explained in

Compare how 6 books explain Proof Key for Code Exchange →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.