Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
const passport = require('koa-passport');
const BasicStrategy = require('passport-http').BasicStrategy;
//we need user model to connect to DB to verify user credentials
const User = require('./models/users');
//implement the basic auth strategy
passport.use(new BasicStrategy(
function(userid, password, done) {
User.findOne({ username:userid, password:password}, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, user); }
return done(null, user);
});
}
));