liveBook · Manning

Proof Key for Code Exchange

As explained in ASP.NET Core in Action, 3e

Authorization code with PKCE is an OAuth authorization flow that protects the authorization code exchange with a proof key generated by the client.

Proof Key for Code Exchange (PKCE) extends the OAuth 2.0 authorization code flow. The client generates a proof key that protects the exchange of an authorization code for a token, adding protection against certain attacks. section 25.1.3

Use PKCE to distinguish common OAuth 2.0 scenarios:

  • Favor authorization code with PKCE when a user initiates an interactive authorization flow. section 25.1.3 section 25.7
  • Use client credentials instead when one API calls another without a user. section 25.1.3 section 25.7
  • Treat PKCE as authorization protection, not as authentication; OpenID Connect adds authentication to OAuth 2.0. section 25.1.3

Interactive photo access

A user authorizes dogphotos.com to access photos through Facebook. The application uses the authorization code with PKCE flow to obtain a token, while the proof key adds protection to the code exchange. section 25.1.3

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines PKCE’s protective role and contrasts grant choices, but does not detail proof-key generation or exchange mechanics.
Examples
Uses dogphotos.com accessing Facebook photos as an OAuth authorization example.
What it assumes
Assumes basic OAuth 2.0 authorization concepts and distinguishes user-delegated access from API-to-API authorization.
What you can do after
Evaluate/understand when authorization code with PKCE fits interactive OAuth flows instead of machine-only client credentials.
How it connects
Connects OAuth 2.0, authorization code flow, client credentials, and OpenID Connect.

Also explained in

Compare how 5 books explain Proof Key for Code Exchange →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.