passport-local
passport-local copied to clipboard
can't use it for multi users on multi dbs
Hi, my service serves more then one app.
Meaning he provides login/signup services for more then one clients who has a different db.
How do I use the simple local strategy to save to a different db every time??
passport.use(new LocalStrategy({ usernameField: 'email' }, function(email, password, done) {
User.findOne({ email: email }, function(err, user) {
if (!user) return done(null, false, { message: 'Email ' + email + ' not found'});
user.comparePassword(password, function(err, isMatch) {
if (isMatch) {
return done(null, user);
} else {
return done(null, false, { message: 'Invalid email or password.' });
}
});
});
}));
+1
Do you mind giving a more elaborate example?