Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use it for multi users on multi dbs #78

Open
ohadperry opened this issue May 25, 2014 · 2 comments
Open

can't use it for multi users on multi dbs #78

ohadperry opened this issue May 25, 2014 · 2 comments

Comments

@ohadperry
Copy link

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.' });
            }
        });
    });
}));
@shlima
Copy link

shlima commented Sep 3, 2014

+1

@GochoMugo
Copy link

Do you mind giving a more elaborate example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants