flask-jwt-simple icon indicating copy to clipboard operation
flask-jwt-simple copied to clipboard

flask-jwt-simple fail with python3.9

Open eamanu opened this issue 4 years ago • 1 comments

flask-jwt-simple fail with py3.9

self = <flask_jwt_simple.jwt_manager.JWTManager object at 0x7eff8c2092b0>
identity = 'username'

    def _create_jwt(self, identity):
        jwt_data = self._get_jwt_data(identity)
        secret = config.encode_key
        algorithm = config.algorithm
>       return jwt.encode(jwt_data, secret, algorithm).decode('utf-8')
E       AttributeError: 'str' object has no attribute 'decode'

flask_jwt_simple/jwt_manager.py:175: AttributeError

Original bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979713

eamanu avatar Feb 11 '21 20:02 eamanu

I am also experiencing this on python 3.8 with create method.

user = User.query.filter_by(email=email).first()
        if user.validate(password):
            response_msg = {'jwt': create_jwt(identity=email)}
            status_code = 200

results in: "msg": "'str' object has no attribute 'decode'"

jferragut avatar Feb 16 '21 18:02 jferragut