vimalloc / flask-jwt-extended

An open source Flask extension that provides JWT support (with batteries included)!
http://flask-jwt-extended.readthedocs.io/en/stable/
MIT License
1.56k stars 239 forks source link

TypeError: check_if_token_in_blacklist() takes 1 positional argument but 2 were given #511

Closed CristianPi closed 1 year ago

CristianPi commented 1 year ago

Just upgraded flask and jwt-extended, followed the migration guide.

    @app.before_request
    def before_request():
        # populate the claims on the request
        verify_jwt_in_request(optional=True) # crash here <-
def verify_token_not_blocklisted(jwt_header: dict, jwt_data: dict) -> None:
    jwt_manager = get_jwt_manager()
    if jwt_manager._token_in_blocklist_callback(jwt_header, jwt_data): 
        raise RevokedTokenError(jwt_header, jwt_data)

it seems to work with

 jwt_manager._token_in_blocklist_callback(jwt_data)
CristianPi commented 1 year ago

sorry, i found the problem

    @jwt.token_in_blocklist_loader
    def check_if_token_in_blacklist(decrypted_token):
        jti = decrypted_token['jti']
        return jti in BLACKLIST

forgot to migrate this