Single token refresh does not behave as described
See original GitHub issueAs discussed here https://github.com/flavors/django-graphql-jwt/issues/2#issuecomment-424451507, if RefreshToken is called after JWT_EXPIRATION_DELTA, an error is returned.
This makes JWT_REFRESH_EXPIRATION_DELTA redundant, since after JWT_EXPIRATION_DELTA, the token cannot be refreshed.
This behaviour is in conflict with the docs that seem to suggest (in the diagrams) that refreshing a token can still be done after JWT_EXPIRATION_DELTA. This makes a lot more sense than the current behaviour.
Possible cause
This is likely due to the get_payload function not making a distinction between tokens that have JWT_EXPIRATION_DELTA and those that have reached JWT_REFRESH_EXPIRATION_DELTA.
This seems like the bug, since it makes single token refresh pretty useless unless the client sends a refresh token every 5 minutes (or whatever JWT_EXPIRATION_DELTA is set to) regardless. That means that clients who are not active for more than 5 minutes will have to log in again, which isn’t how JWT usually works.
Instead, JWT_REFRESH_EXPIRED_HANDLER is called after get_payload.
Therefore the “Refresh has expired” exception can never be raised since “Signature has expired” will be raised first (as the refresh delta is usually longer than the expiration delta).
Possible fix
get_payload should not raise any errors until the JWT_REFRESH_EXPIRED_HANDLER has been called.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)

Top Related StackOverflow Question
In case this is an issue, and other people come across it with the same problem: here’s a patch.
I’ve begun work on implementing this without database additions on a fork. One change needs to be made where refresh time limit needs to be part of the token. Then it will work as described. PR #116