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:

  1. Sessions
  2. 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.

Log in or Sign up to view the complete tutorial.

Sign in with your Osio Labs account
to gain instant access to our entire library.