From bc6b9fe955224b0ea8b2df374cf63085c8cfbc08 Mon Sep 17 00:00:00 2001 From: Odeh Adejoh <42589643+stradox4u@users.noreply.github.com> Date: Sun, 8 Aug 2021 14:11:15 +0100 Subject: [PATCH] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ffd80c08..55fcfef8 100644 --- a/README.md +++ b/README.md @@ -48,14 +48,18 @@ authentication using [OAuth](http://oauth.net/) (for example, via [Facebook](htt or [Twitter](http://twitter.com/)), or federated authentication using [OpenID](http://openid.net/). Before authenticating requests, the strategy (or strategies) used by an -application must be configured. +application must be configured. The configuration should be modified to fit your database system/driver. Below is the mongoose implementation. ```javascript passport.use(new LocalStrategy( function(username, password, done) { + // Find the user from the database () User.findOne({ username: username }, function (err, user) { + // Handle database error if (err) { return done(err); } + // Handle user not in database if (!user) { return done(null, false); } + // Verify supplied password if (!user.verifyPassword(password)) { return done(null, false); } return done(null, user); });