Skip to content

OustandingToken only created when refresh token is used to get a new key pair and not at creation ? Bug ?  #363

Closed
@StitiFatah

Description

@StitiFatah

from the doc :

If the blacklist app is detected in INSTALLED_APPS, Simple JWT will add any generated refresh or sliding tokens to a list of outstanding tokens. It will also check that any refresh or sliding token does not appear in a blacklist of tokens before it considers it as valid.

I'm working with 'ROTATE_REFRESH_TOKENS': True and 'BLACKLIST_AFTER_ROTATION': True

When asking for a token pair through TokenObtainPairView it indeed directly create an OutstandingToken referencing the given refresh_token but when asking for a new pair via TokenRefreshView no OutstandingToken referencing the new given refresh token is created but instead it creates an OutstandingToken for the refresh_token which was used to ask a new pair and thus a BlacklistedToken.
Don't know if it's clear enough. In summary it's :

1-Login through /api/token --> 1 pair given ( let's call the refresh one refresh_token_0 ) --> outstanding_token_0 created from refresh_token_0
2-Claiming a new pair through /api/token/refresh ---> 1 new pair given, outstanding_token_0 is blacklisted but no outstanding_token_1 created
3-Claiming a new pair through /api/token/refresh with token_refresh_1, 1 new pair given and then oustanding_token_1 created + blacklisted

Expected behavior :

1-Login through /api/token --> 1 pair given ( let's call the refresh one refresh_token_0 ) --> outstanding_token_0 created from refresh_token_0
2-Claiming a new pair through /api/token/refresh ---> 1 new pair given, outstanding_token_0 is blacklisted and outstanding_token_1 created
3-Claiming a new pair through /api/token/refresh with token_refresh_1, new pair given, outsatnding_token_1 blacklisted then oustanding_token_2 created

So apart from the first claim when the user ask for credentials himself the new generated refresh tokens aren't creating outstanding token (when generated from /api/token/refresh), It waits for a new /api/token/refresh claim with this token to create outsanding token referecing it + blacklist in the same time.

Is this the expected behavior and I am missing something ? What's the point of Outstanding Token if it's directly blacklisted ( apart from the first time at user's login ) and not created one cycle before ? Is it possible to create them when generated ?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions