diff --git a/oidc_provider/lib/utils/token.py b/oidc_provider/lib/utils/token.py index 9ef7dd2..de93ea2 100644 --- a/oidc_provider/lib/utils/token.py +++ b/oidc_provider/lib/utils/token.py @@ -49,7 +49,7 @@ def encode_id_token(id_token_dic, client_secret): Return a hash. """ - id_token_hash = jwt.encode(id_token_dic, client_secret) + id_token_hash = jwt.encode(id_token_dic, client_secret).decode('utf-8') return id_token_hash diff --git a/oidc_provider/tests/test_authorize_endpoint.py b/oidc_provider/tests/test_authorize_endpoint.py index b5ba5e4..a1a6310 100644 --- a/oidc_provider/tests/test_authorize_endpoint.py +++ b/oidc_provider/tests/test_authorize_endpoint.py @@ -147,7 +147,7 @@ class AuthorizationCodeFlowTestCase(TestCase): } for key, value in iter(to_check.items()): - is_input_ok = input_html.format(key, value) in response.content + is_input_ok = input_html.format(key, value) in response.content.decode('utf-8') self.assertEqual(is_input_ok, True, msg='Hidden input for "'+key+'" fails.') diff --git a/oidc_provider/tests/test_token_endpoint.py b/oidc_provider/tests/test_token_endpoint.py index 008e6fc..1bd6568 100644 --- a/oidc_provider/tests/test_token_endpoint.py +++ b/oidc_provider/tests/test_token_endpoint.py @@ -101,7 +101,7 @@ class TokenTestCase(TestCase): 'state': self.state, } response = self._post_request(post_data) - response_dic = json.loads(response.content) + response_dic = json.loads(response.content.decode('utf-8')) self.assertEqual('access_token' in response_dic, True, msg='"access_token" key is missing in response.') @@ -117,7 +117,7 @@ class TokenTestCase(TestCase): invalid_data['code'] = code.code response = self._post_request(invalid_data) - response_dic = json.loads(response.content) + response_dic = json.loads(response.content.decode('utf-8')) self.assertEqual('error' in response_dic, True, msg='"error" key should exists in response.')