Node.js Express Login example with MongoDB

By DEV Community - 2020-12-27

Description

In this tutorial, we're gonna build a Node.js & MongoDB example that supports User Authentication... Tagged with node, javascript, security, webdev.

Summary

  • Token Based Authentication Comparing with Session-based Authentication that need to store Session on Cookie, the big advantage of Token-based Authentication is that we store the JSON Web Token (JWT) on Client side: There are three important parts of a JWT: Flow for Signup & Login with JWT Authentication A legal JWT must be added to HTTP x-access-token Header if Client accesses protected resources.
  • Controllers interact with MongoDB Database via Mongoose library and send HTTP response (token, user information, data based on roles...) to Client.

 

Topics

  1. Mobile (0.27)
  2. Frontend (0.21)
  3. Backend (0.21)

Similar Articles

5 ways to make HTTP requests in Node.js

By LogRocket Blog - 2021-02-04

Make HTTP requests in Node.js using the native module as well as npm packages like Axios, Got, SuperAgent, and node-fetch.

PHP vs Node.js

By DEV Community - 2020-12-27

Web development is constantly changing. In order to stay relevant, programmers must analyze trends an... Tagged with programming, php, node.

How to use IndexedDB to build Progressive Web Apps

By Medium - 2020-09-01

In this previous post, I talked about implementation of IndexedDB inside Service Workers. If you don’t understand that part, please read that article to clear up some concepts about service workers…