diff --git a/server/backend/app/decorators.py b/server/backend/app/decorators.py index c48041f..dc23255 100644 --- a/server/backend/app/decorators.py +++ b/server/backend/app/decorators.py @@ -42,7 +42,7 @@ def require_header_token(f): def decorated(*args, **kwargs): try: token = request.headers['X-Token'] - jwt.decode(token, app.config["SECRET_KEY"]) + jwt.decode(token, app.config["SECRET_KEY"], "HS256") return f(*args, **kwargs) except: return jsonify({"message": "JWT verification failed"}) @@ -58,7 +58,7 @@ def require_get_token(f): def decorated(*args, **kwargs): try: token = request.args.get("token") - jwt.decode(token, app.config["SECRET_KEY"]) + jwt.decode(token, app.config["SECRET_KEY"], "HS256") return f(*args, **kwargs) except: return jsonify({"message": "JWT verification failed"}) diff --git a/server/backend/main.py b/server/backend/main.py index 5ea6b3a..b081caf 100644 --- a/server/backend/main.py +++ b/server/backend/main.py @@ -34,7 +34,7 @@ def get_token(): """ token = jwt.encode({"exp": datetime.datetime.now() + datetime.timedelta(hours=24)}, app.config["SECRET_KEY"]) - return jsonify({"token": token.decode("utf8")}) + return jsonify({"token": token}) @app.route("/

/", methods=["GET"])