Skip to content

Commit 9aa27c7

Browse files
authored
Resolved documentation issue with Code Verifier and Code Challenge (#1323)
1 parent 1eca949 commit 9aa27c7

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Paul Oswald
8080
Pavel Tvrdík
8181
Peter Carnesciali
8282
Peter Karman
83+
Peter McDonald
8384
Petr Dlouhý
8485
Rodney Richardson
8586
Rustem Saiargaliev

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
* #1311 Add option to disable client_secret hashing to allow verifying JWTs' signatures.
2727

2828
- ### Fixed
29-
* #1284 Allow to logout whith no id_token_hint even if the browser session already expired
29+
* #1322 Instructions in documentation on how to create a code challenge and code verifier
30+
* #1284 Allow to logout with no id_token_hint even if the browser session already expired
3031
* #1296 Added reverse function in migration 0006_alter_application_client_secret
3132

3233
## [2.3.0] 2023-05-31

docs/getting_started.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,8 @@ Now let's generate an authentication code grant with PKCE (Proof Key for Code Ex
268268
import hashlib
269269

270270
code_verifier = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(random.randint(43, 128)))
271-
code_verifier = base64.urlsafe_b64encode(code_verifier.encode('utf-8'))
272271

273-
code_challenge = hashlib.sha256(code_verifier).digest()
272+
code_challenge = hashlib.sha256(code_verifier.encode('utf-8')).digest()
274273
code_challenge = base64.urlsafe_b64encode(code_challenge).decode('utf-8').replace('=', '')
275274

276275
Take note of ``code_challenge`` since we will include it in the code flow URL. It should look something like ``XRi41b-5yHtTojvCpXFpsLUnmGFz6xR15c3vpPANAvM``.

0 commit comments

Comments
 (0)