From 154a0b19478e6c27fda9e8014931f6b0b1e7c7b3 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Thu, 31 Dec 2020 18:08:08 +0800 Subject: `jwt.encode` returns a string, not a bytestring. As of pyjwt 2.0.0, `jwt.encode` does not return a bytestring, so decoding is unnecessary. ref: https://github.com/jpadilla/pyjwt/blob/c96131b970fd341106ce33d0a85b50e3bdbb67ec/CHANGELOG.md#jwtencode-return-type --- backend/routes/auth/authorize.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'backend/routes/auth/authorize.py') diff --git a/backend/routes/auth/authorize.py b/backend/routes/auth/authorize.py index 2509109..975936a 100644 --- a/backend/routes/auth/authorize.py +++ b/backend/routes/auth/authorize.py @@ -55,6 +55,4 @@ class AuthorizeRoute(Route): token = jwt.encode(user_details, SECRET_KEY, algorithm="HS256") - return JSONResponse({ - "token": token.decode() - }) + return JSONResponse({"token": token}) -- cgit v1.2.3