gothinkster / flask-realworld-example-app

Exemplary real world JSON API built with Flask (Python)
https://realworld.io/
MIT License
897 stars 308 forks source link

Flask-JWT-Extended breaks compatibility #50

Open JulienPalard opened 2 years ago

JulienPalard commented 2 years ago

Quick fix is to use Flask-JWT-Extended<4 in the requirements/prod.txt but maybe someone want to port flask-realworld-example-app to Flask-JWT-Extended 4?

fly2099 commented 2 years ago

3 important points to fix from source cde 1, @jwt_optional==>@@jwt_required(optional=True) 2, @jwt_required==>@jwt_required() 3, change jwt_identity take 2 pars:

def jwt_identity(jwt_header, jwt_payload):
    identity = jwt_payload["sub"]
    return User.query.filter_by(id=identity).one_or_none()