🔑Proof Key for Code Exchange (PKCE)
Also known as PKCE, Code Challenge, Code Verifier, OAuth PKCE
An extra check in OAuth. A stolen code does not work without the app's secret.
Think of it like
Think of it like a coat check. You keep half the ticket, so only you can get the coat back.
Example
Emma's phone app starts a login with a PKCE challenge. A bad app on the same phone grabs the code on its way back. It cannot swap it, because it never saw the secret.
Why it matters
Without it, any app that catches the code on its way back can turn it into a token.
Definition
Example code
http
GET /authorize?response_type=code&client_id=shop-app&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256 HTTP/1.1Common mistake
Key takeaways
- 1Secret kept. The app makes it and keeps it.
- 2Hash sent first. Only the hash goes out.
- 3Proof at the swap. The code needs the secret.