9 cards
code_verifier
A CSPRNG random string of 43-128 characters (unreserved), generated in `/auth/web/login` and stored in SessionID1.
code_challenge
`BASE64URL(SHA256(code_verifier))`, strip `=` padding, replace `+`→`-`, `/`→`_`; sent together with `code_challenge_method=S256`.
What PKCE prevents
Authorization code interception: whoever steals the code cannot exchange it for a token without the code_verifier.
state
A random value sent to /authorize that the IdP returns unchanged to the callback; the BFF compares it with the state in SessionID1 to prevent CSRF on the callback (login CSRF).
nonce
A random value sent to /authorize that the IdP embeds in the id_token `nonce` claim; the BFF compares it with the nonce in SessionID1 to prevent id_token replay.
The bindings you must have
state ↔ SessionID1, nonce ↔ id_token, code_verifier ↔ code; plus xsrfToken ↔ SessionID2.
Missing state → which vulnerability
The attacker plants their own code in the victim's callback → the victim is logged into the attacker's account (login CSRF).
Missing nonce → which vulnerability
An old id_token is replayed into another callback and the BFF still accepts it.
Missing PKCE → which vulnerability
An intercepted code (proxy logs, a malicious app with the same redirect scheme) can be exchanged for a token.