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

Add support for PyJwt_2_0_0 #206

Merged
merged 13 commits into from Jan 5, 2021
5 changes: 4 additions & 1 deletion sanic_jwt/authentication.py
Expand Up @@ -495,7 +495,10 @@ async def generate_access_token(
extend_payload, payload=payload, user=user
)

return jwt.encode(payload, secret, algorithm=algorithm).decode("utf-8")
access_token = jwt.encode(payload, secret, algorithm=algorithm)
if isinstance(access_token, bytes):
return access_token.decode("utf-8")
return access_token

async def generate_refresh_token(self, request, user):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -29,7 +29,7 @@ def open_local(paths, mode="r", encoding="utf8"):
for reqs in extras_require.values():
extras_require["all"].extend(reqs)

install_requires = ["pyjwt"]
install_requires = ["pyjwt==2.0.0"]

setup(
name="sanic-jwt",
Expand Down