OpenAPI

BUILD

PKCE

Proof Key for Code Exchange protects the authorization code when the browser cannot keep a client secret.

S256 outline
const verifier = createHighEntropyRandomString();
const challenge = base64url(sha256(verifier));
// Send challenge with /oauth/authorize. Keep verifier server-side
// until the matching /oauth/token exchange.

Do

  • Use S256.
  • Generate a new verifier per request.
  • Keep the verifier secret until token exchange.
  • Reject a response whose state does not match.