Fix encoding problem when using Py34.

This commit is contained in:
Ignacio Fiorentino 2016-04-08 13:22:05 -03:00
parent ed26f7bb40
commit e97c32acd1

View file

@ -99,7 +99,9 @@ class TokenEndpoint(object):
# Validate PKCE parameters. # Validate PKCE parameters.
if self.params.code_verifier: if self.params.code_verifier:
if self.code.code_challenge_method == 'S256': 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: else:
new_code_challenge = self.params.code_verifier new_code_challenge = self.params.code_verifier