Giter Club home page Giter Club logo

Comments (2)

dios231 avatar dios231 commented on June 7, 2024

The main benefit of JWT is that is stateless. With other words this means that the backend does not know anything about the user outside of a typical flow request/response. Storing any information regarding a user on the backend essentially you break the stateless concept. This is not necessarily bad, but as everything, so does has the pros and cons.

Typical you can store these JWTs on the backend (e.x in a database table) or create backend sessions to have real-time monitoring.

But if you really want to do such a thing I would suggest to leave the JWTs tokens because seems like a layer that you do not actually want.

from django-rest-framework-jwt.

fablet avatar fablet commented on June 7, 2024

You might be able to use the JWT_GET_USER_SECRET_KEY setting to create a custom function to generate the secret key for the user based on some changing piece of login data stored on the user.
I use a function for this setting to invalidate all old tokens if the user changes their username or password, but you may be able to store and use something like current login IP address, or current login time. You would have to update the user with that data before creating the token, but it would then invalidate all but the login token created with that new secret key.

from django-rest-framework-jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.