Introducing Passport
Passport is an authentication framework for Node.js. It can act as Express middleware, making it easy to integrate with our application.
Like some of the other libraries we've discussed so far, Passport is very modular. Its core package provides a common paradigm for authentication. Passport's middleware performs authentication and augments the request object with a user
property.
Additional Passport npm packages support hundreds of different strategies for authentication. Each Passport strategy provides a different mechanism for identifying users. We'll look at a few of these strategies in this chapter. Passport makes it easy to add new strategies to suit the needs of each application.
Choosing an authentication strategy
A common introductory example is username/password-based authentication. This uses a login form to verify users' credentials against the application's database. Although this is one of the simplest authentication mechanisms to...