pythonflaskjwtflask-jwt-extended

AttributeError: 'JWTManager' object has no attribute 'token_in_blacklist_loader'


I'm getting this weird error when adding the flask-jwt-extended decorator token_in_blacklist_loader in to my code. here is the error:

Traceback (most recent call last):
  File "home/app.py", line 42, in <module>
    @jwt.token_in_blacklist_loader
AttributeError: 'JWTManager' object has no attribute 'token_in_blacklist_loader'

here is my code:

@jwt.token_in_blacklist_loader
def check_if_token_is_revoked(decrypted_token):
    jti = decrypted_token['jti']
    token_in_redis = jwt_redis_blacklist.get(jti)
    return token_in_redis is not None

Thank you in advance for your valuable feedbacks!


Solution

  • As mentioned here:

    token_in_blacklist_loader has been renamed to token_in_blocklist_loader

    You need to replace @jwt.token_in_blacklist_loader with @jwt.token_in_blocklist_loader