SimpleJWT returns different access and refresh token each time


So, I have a django project, and have added JWT authentication. The problem is that each time I use TokenObtainPairView with the same credentials I get different access and refresh tokens. Is this the default behavior, as I have not changed anything in the settings? Is there a way to get the previous token unless it has expired?

If you need more info please let me know.

>Solution :

JWTs aren’t stored anywhere, that’s the entire point of them. So you can never get "the" token again. You will get an equivalent, newly generated token. Since tokens incorporate timestamps/random ids etc, you probably won’t ever get the same token twice.

Leave a Reply Cancel reply