Home > Net >  SimpleJWT returns different access and refresh token each time
SimpleJWT returns different access and refresh token each time

Time:01-26

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.

CodePudding user response:

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.

  • Related