Skip to content

Commit

Permalink
Fixbug Type error a bytes-like (#1204)
Browse files Browse the repository at this point in the history
Added encode 'utf-8' for code_verifier
  • Loading branch information
islam-kamel committed Sep 18, 2022
1 parent 235e3f8 commit fc0906d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Now let's generate an authentication code grant with PKCE (Proof Key for Code Ex
import hashlib

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

code_challenge = hashlib.sha256(code_verifier.encode('utf-8')).digest()
code_challenge = base64.urlsafe_b64encode(code_challenge).decode('utf-8').replace('=', '')
Expand Down

0 comments on commit fc0906d

Please sign in to comment.