To save a session, there are two approaches:
To implement a persistent session, you can use the MongoDB session store or the Redis session store.
If you want to use redis, use the connect-redis npm package. If you want to use MongoDb as a session repository, use the connect-mongo npm package
There are several settings that you need to make in the app.js / server.js application. In one of my demos, I use the Redis Session store with PassportJS, if you are looking for an example, feel free to look here .
If you want to use JSON tags for websites , many different implementations are available. I am using jsonwebtoken . I implemented this using PassportJS, ExpressJS and AngularJS in front of End. For example, look here . Tokens are encoded and stored in the local storage of the browser using a secret key.
I would suggest you go for JSON tokens, read it in detail, because this is how most major web applications develop. Let me know if you need more help.
source share