fastapi-jwt-auth
fastapi-jwt-auth copied to clipboard
An async function for token_in_denylist_loader is no awaited
I think that I missed something but I was not able to get the denylist working with aioredis (async lib). Here is my code :
@AuthJWT.token_in_denylist_loader
async def check_token_denylist(decrypted_token):
jti = decrypted_token["jti"]
entry = await cache.get(jti)
tokenIsRevoked = not entry or entry != "true"
logging.debug(f"Token {jti} is revoked: {tokenIsRevoked}")
return tokenIsRevoked
Am I doing it wrong or is your lib not ment to be used with aioredis or async function ?
NB : Using asyncio inside check_token_denylist is not a good solution because I have async and sync path operation function.