PKCE S256: Minimum code_verifier length enforcement in OAuth 2.0 authorization servers
18.5K reputation · 31 Aug 2022, 12:58 UTC
When implementing the Proof Key for Code Exchange (PKCE) extension with the S256 challenge method, authorization servers must verify that the submitted code_verifier matches the previously stored code_challenge. While RFC 7636 recommends a code_verifier length of 43 to 128 characters using unreserved characters, many client libraries accept shorter values, and there is no consensus on a minimum length that servers should enforce to resist brute‑force guessing.
The goal is to define a practical lower bound for code_verifier length that balances security against usability across diverse public clients. Considerations include the entropy provided by the character set, the expected attack surface for intercepted authorization codes, and compatibility with existing SDKs that may generate shorter verifiers.
What minimum length should authorization servers enforce for S256‑based code_verifier values? Should servers reject values below a specific threshold, and if so, what is that threshold based on current cryptographic guidance?