I want to switch from using Flask-JWT since it is no longer being updated. My problem is that I'm not sure how to achieve some of the functionality that Flask-JWT was giving me. For example:
jwt = JWT(app, verify, identify)
With Flask-JWT i could pass the flask app, authentication method and a identify
function that does he following:
def identify(payload):
user_id = payload['identity']
return {"user_id": user_id}
Now my main problem is that I do not fully understand what the decorator @jwt_required()
does and how I could replicate it using PyJWT. So if I had the following function:
class PrivateResource(Resource):
@jwt_required()
def get(self):
return {"badge_number": 445566}
How could I do the same function as @jwt_required()
while using PyJWT?