Godfather Godfather - 8 months ago 129
Node.js Question

How to authenticate user when cookies are disabled?

I am using passportjs for user authentication, it includes both local authentication and oauth authentication, the app is working fine when cookies are enabled, but when user disable the cookies it doesn't authenticate the user, i am using session based authentication.


Session-based authentication like express-session requires cookies. Express-session uses cookies to store the session.id. Unless you have another way to store the session.id on the client-side and pass that information back to your session handler, you won't be able to use passport's session-based authentication.

You can also look at this question here, which goes into more depth.

How to do stateless (session-less) & cookie-less authentication?