Fix redis checking for token invalidation

This commit is contained in:
Thastertyn 2024-03-07 07:51:58 +01:00
parent d0fd8a34f5
commit 63ef1179fc
2 changed files with 5 additions and 3 deletions

View File

@ -14,4 +14,6 @@ def create_app():
from app.config import FlaskTesting, FlaskProduction
app.config.from_object(FlaskTesting)
from . import jwt_utils
return app

View File

@ -2,11 +2,11 @@ from app.extensions import jwt_redis_blocklist
from . import jwt_manager
@jwt.token_in_blocklist_loader
from app import app
@jwt_manager.token_in_blocklist_loader
def check_if_token_is_revoked(jwt_header, jwt_payload: dict) -> bool:
jti = jwt_payload["jti"]
token_in_redis = jwt_redis_blocklist.get(jti)
print(token_in_redis)
return token_in_redis is not None