I think you need to pass the done()
object inside your BasicStrategy
. As far as I remember, the JS passport uses this object to populate req.user in express applications, and because of this, I think that it probably expects object
not a boolean
.
Here is a more robust example of the same function that I use in many applications:
passport.use(new BasicStrategy( function(clientID, clientSecret, done) { AuthClient.findOne({ clientID: clientID }, function(err, client) { if (err) { return done(err); } if (!client) { return done(null, false); } if (client.secret != clientSecret) { return done(null, false); } return done(null, client); }); } ));
As you can see, BasicStrategy uses clientID and clientSecret for analysis, which is equivalent to a combination of your username and password. Since you are not actually pulling it from db, as shown in my example, I would expect that if you just follow the above sentence and pass {}
to done(null, {})
, it might work better.
source share