Set Up ExpressJS Session Authentication for Node Applications
When creating an application that authenticates users, you have two main choices for authorization and storing user data:
- Sessions
- JSON Web Tokens (JWT)
Sessions are the traditional method and used by many applications. It is a straightforward and secure way to manage the user data your application needs for page loads. The express-session project is a handy library for adding session handling into your ExpressJS applications. It is the standard used by most organizations today.
In this tutorial we'll:
- Learn how to install and setup express-session
- Generate and assign random session IDs
- Configure session cookies in our Node application
- Add express-session to an existing ExpressJS form
By the end of this tutorial, you should have a firm understanding of how to use express-session to allow users to log in to a Node.js application.
This tutorial is part 6 of 7 tutorials that walk through using Express.js for user authentication.
Sign in with your Osio Labs account
to gain instant access to our entire library.