Fix PKCE code verifier encoding to match specification

The current implementation of PKCE does not follow the specification
correctly regarding the encoding of the code verifier. This patch
correctly encodes the hash of the code verifier according to
Appenix A of RFC 7636.
This commit is contained in:
François Kooman
2017-01-24 11:36:34 +01:00
parent 0da70c916a
commit 6426e597a3
2 changed files with 2 additions and 2 deletions

View File

@ -144,7 +144,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
case 'S256':
if (
hash_equals(
urlencode(base64_encode(hash('sha256', $codeVerifier))),
strtr(rtrim(base64_encode(hash('sha256', $codeVerifier)), '='), '+/', '-_'),
$authCodePayload->code_challenge
) === false
) {