Git Product home page Git Product logo

Comments (2)

iaincollins avatar iaincollins commented on May 23, 2024

Pull requests with JWT sessions would be great. I appreciate it's a lot of work so seems unlikely, but even if it's only a partial implementation it would be something.

from nextjs-starter.

iaincollins avatar iaincollins commented on May 23, 2024

While appealing I think there are too many problems using only JWT tokens in practice, especially with oAuth.

For example because it doesn't store the RefreshToken server side, if the resets their local data or uses another browser or computer, then you can't get an updated AccessToken later if you want to make API calls - as APIs like Google+ only return a RefreshToken the first time a user signs in to a new service.

Storing things entirely client side in a JWT token (that is encrypted/decrypted on the server) is okay for some uses cases, but it's very limiting for many scenarios so I'm not going to worry about it now I have published the code for session management in next-auth and next-auth-client.

There is a case for using JWT tokens instead of having a session database (but still having a user database), but that's a slightly more specific use case that has some pitfalls of it's own - and the overhead of having a session database is low in most scenarios (especially as, in this example, it can just be a collection in the same database as the user data).

I'm going to close this issue. If it reopens at all it will probably be an enhancement to next-auth.

from nextjs-starter.

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.