Last active
October 4, 2019 04:47
-
-
Save techitesh/b6702cb952640fa2d9dc21e6b9554121 to your computer and use it in GitHub Desktop.
Passport Basic Auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const passport = require('passport') | |
const BasicStrategy = require('passport-http').BasicStrategy | |
passport.use(new BasicStrategy( | |
function(userid, password, done) { | |
if(userid !== 'admin') return done(null, false) | |
if(password !== 'admin@123') return done(null, false) | |
if(userid == 'admin' && password == 'admin@123') { | |
return done(null,true) | |
} | |
} | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment