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

PyJWT encode return type has changed #7

Open
sean-bytefoundry opened this issue Mar 31, 2021 · 1 comment
Open

PyJWT encode return type has changed #7

sean-bytefoundry opened this issue Mar 31, 2021 · 1 comment

Comments

@sean-bytefoundry
Copy link

As of version 2.0, the return type for jwt.encode is string instead of byte string, causing encode and decode tests to fail.

@jaytaytay
Copy link

jaytaytay commented Feb 14, 2022

After reading this I've added these 3 lines to the end of encode_access_token in models.user.py

    token = jwt.encode(payload, key, algorithm="HS256")
    if isinstance(token, str):
        token = token.encode("UTF-8")

which resolved this issue for me. Perhaps it has introduced new issues, hope not!

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