passport.js is a middleware provided by Node.js for authentication. The functionality of passport.js is to authenticate the requests that are made to the server. It provides several strategies for authentication. passport.js provides strategies to such as local strategy, Facebook strategy, Google strategy, Twitter strategy, and JWT strategy. In this chapter, we will focus on using the JWT strategy.
Introduction to passport.js
JWT
JWT is a way of authenticating the requests using a token-based approach. There are two methods of authenticating requests: cookie-based authentication, and token-based authentication. The cookie-based authentication mechanism saves the user's session ID in the browser's cookie, whereas...