Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading