Skip to content

An async function for token_in_denylist_loader is no awaited #83

@Altaroc

Description

@Altaroc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions