Closed jrschiestle closed 1 month ago
Note the issue still seems to be active, and this is using
See below the trace
File "/usr/local/lib/python3.11/site-packages/pycognito/__init__.py", line 704, in renew_access_token
self._set_tokens(refresh_response)
File "/usr/local/lib/python3.11/site-packages/pycognito/__init__.py", line 779, in _set_tokens
self.verify_token(tokens["AuthenticationResult"]["IdToken"], "id_token", "id")
File "/usr/local/lib/python3.11/site-packages/pycognito/__init__.py", line 289, in verify_token
digest = alg_obj.compute_hash_digest(self.access_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jwt/algorithms.py", line 168, in compute_hash_digest
digest.update(bytestr)
TypeError: argument 'data': from_buffer() cannot return the address of a unicode object
Minimal amount of code to reproduce the issue
import jwt
access_token = ''
alg_obj = jwt.get_algorithm_by_name('RS256')
digest = alg_obj.compute_hash_digest(access_token)
I just hit this issue too.
Added compatibility fixes for different byte vs str inputs and outputs. Prevents TypeErrors seen with: