- [Narrator] Passport is the most widely-used
authentication module for Node.js.
Conceptually, Passport provides an authenticate function.
This function uses a so-called strategy
to authenticate the user.
Strategies are pluggable authentication modules
that can be installed separately.
Through these strategies, Passport covers
a lot of back ends or use cases from local authentication
that is mostly used to authenticate against
the local database to strategies for a variety
of third-party systems,
including single sign-on providers
and logins via social media concepts,
like Facebook, or other exotic systems Shoplet.
Right now, there are over 500 strategies available.
Once Overview successfully authenticated, Passport
also takes care of storing the user in the session, and
restoring it for every request.
To use Passport in Express, it needs to be hooked into
the application with, you might've guessed it,
two middle definitions.
What do these two middle functions do?
First we have initialize, it returns a middleware function
that uses the request object to
store passport internal data in.
And then, we need passport dot session.
It looks for previously serialized user in the current
session and uses a provided deserialization function to
provide the user in request dot user to all
following middlewares and routes.
In the next videos, we are going to add Passport to
our sample project and we will create a strategy
to authenticate users against the database.