...

/

Introduction to Passport.js and JSON Web Tokens

Introduction to Passport.js and JSON Web Tokens

Get an overview of Passport.js and JSON Web Tokens.

By the end of this chapter, we’ll be able to do the following:

  • Implement sign-up and login functionalities for our Express Recipes API.
  • Authenticate application users’ requests using Passport.js and JSON Web Tokens.

Passport.js overview

Passport.js is an easy-to-integrate middleware used for authentication.

Passport.js offers various authentication mechanisms (known as strategies) as individually-packaged modules. Currently, more than 500 authentication strategies exist in the Passport.js ecosystem. Strategies include verifying a username and password, delegated authentication using OAuth, and federated authentication using OpenID.

In this chapter, we’ll use the Passport.js authentication strategy based on JSON Web Tokens to add authentication to the Express Recipes API.

JSON Web Tokens overview

In REST architectures, client-server interactions are ...