If you're using this error:
AttributeError: 'JWTManager' object has no attribute 'token_in_blacklist_loader'
it because you're using flask-jwt-extended
version 4
and alot changed in version 4
you can see here. the token_in_blacklist_loader
changed to token_in_blocklist_loader
how to overcome this issue
the recent migration to flask-jwt-extended
made alot of improving and the following function now takes two arguments (jwt_header, jwt_payload)
:
@jwt.needs_fresh_token_loader
@jwt.revoked_token_loader
@jwt.user_lookup_loader
@jwt.user_lookup_error_loader
@jwt.expired_token_loader
@jwt.token_in_blocklist_loader
@jwt.token_verification_loader
@jwt.token_verification_failed_loader
now you can fix the error and the jti
is exist in jwt-payload
:
@jwt.token_in_blocklist_loader
def check_if_token_in_blacklist(jwt_header, jwt_payload):
jti = jwt_payload['jti']
token_in_redis = jwt_redis_blacklist.get(jti)
return token_in_redis is not False
Thank you so much for reading! If you still see any issue, let me know!
Top comments (0)