Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in generate_application_jwt function in jwt.py file #6

Closed
piotr-wasilewski opened this issue Oct 20, 2023 · 3 comments
Closed

Bug in generate_application_jwt function in jwt.py file #6

piotr-wasilewski opened this issue Oct 20, 2023 · 3 comments
Assignees

Comments

@piotr-wasilewski
Copy link

Expected Behavior

should return token

Current Behavior

return bytes(token, 'utf-8') in function generate_application_jwt generates exception in jwt.py

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\piotr\.virtualenvs\canlock-server-mGAFEtYs\lib\site-packages\vonage\voice.py", line 28, in create_call
    return self._client.post(
  File "C:\Users\piotr\.virtualenvs\canlock-server-mGAFEtYs\lib\site-packages\vonage\client.py", line 266, in post
    self._request_headers['Authorization'] = self._create_jwt_auth_string()
  File "C:\Users\piotr\.virtualenvs\canlock-server-mGAFEtYs\lib\site-packages\vonage\client.py", line 437, in _create_jwt_auth_string
    return b"Bearer " + self._generate_application_jwt()
  File "C:\Users\piotr\.virtualenvs\canlock-server-mGAFEtYs\lib\site-packages\vonage\client.py", line 441, in _generate_application_jwt
    return self._jwt_client.generate_application_jwt(self._jwt_claims)
  File "C:\Users\piotr\.virtualenvs\canlock-server-mGAFEtYs\lib\site-packages\vonage_jwt\jwt.py", line 42, in generate_application_jwt
    return bytes(token, 'utf-8')
TypeError: encoding without a string argument

Possible Solution

return bytes(token, 'utf-8')

Steps to Reproduce (for bugs)

changed return bytes(token, 'utf-8') to return token

@maxkahan
Copy link
Collaborator

Hi @piotr-wasilewski I haven't been able to reproduce your issue, this is working fine for me. Can you share more details about the issue you're having?

@maxkahan
Copy link
Collaborator

@piotr-wasilewski this error looks like you haven't generated a token successfully from your private key and are passing an empty string to the bytes method. Can you confirm if that was the case or provide more details so I can reproduce your issue?

@maxkahan
Copy link
Collaborator

@piotr-wasilewski has confirmed to support that the issue was with using an outdated package. Closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants