From e97c32acd1b081c59c9be85db4f45f0ebe949f01 Mon Sep 17 00:00:00 2001 From: Ignacio Fiorentino Date: Fri, 8 Apr 2016 13:22:05 -0300 Subject: [PATCH] Fix encoding problem when using Py34. --- oidc_provider/lib/endpoints/token.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oidc_provider/lib/endpoints/token.py b/oidc_provider/lib/endpoints/token.py index 636a9d1..2a687f5 100644 --- a/oidc_provider/lib/endpoints/token.py +++ b/oidc_provider/lib/endpoints/token.py @@ -99,7 +99,9 @@ class TokenEndpoint(object): # Validate PKCE parameters. if self.params.code_verifier: if self.code.code_challenge_method == 'S256': - new_code_challenge = urlsafe_b64encode(hashlib.sha256(self.params.code_verifier.encode('ascii')).digest()).replace('=', '') + new_code_challenge = urlsafe_b64encode( + hashlib.sha256(self.params.code_verifier.encode('ascii')).digest() + ).decode('utf-8').replace('=', '') else: new_code_challenge = self.params.code_verifier