How to use the use function from passport
Find comprehensive JavaScript passport.use code examples handpicked from public code repositorys.
GitHub: leancloud/ticket
3 4 5 6 7 8 9 10 11 12 13
const AV = require('leanengine') const randomstring = require('randomstring') const config = require('../config') module.exports = (router) => { passport.use( 'xd-cas', new OAuth2Strategy( { authorizationURL: 'https://sso.security.xindong.com/cas/oauth2.0/authorize',
60
277
27
+ 3 other calls in file
GitHub: meifhuang/Gym-Social
49 50 51 52 53 54 55 56 57 58 59 60
app.use(session(sessionConfig)); app.use(passport.initialize()); app.use(passport.session()); // passport.use(new LocalStrategy(User.authenticate())); passport.use(User.createStrategy()) //how to serialize user - store user in a session passport.serializeUser(User.serializeUser()); //unstore
0
1
0
GitHub: JeeIn-Shin/codeReview
1 2 3 4 5 6 7 8 9 10 11
const bcrypt = require('bcrypt'); const passport = require('passport'); const localStrategy = require('passport-local').Strategy; module.exports = () => { passport.use(new localStrategy({ usernameField: 'id', //req.body.id passwordField: 'pwd', //req.body.pwd session: true, passReqToCallback: false
4
0
1
51 52 53 54 55 56 57 58 59
app.use(passport.initialize()); app.use(passport.session()); // Setup passport passport.use(new LocalStrategy(async function verify(username, password, cb) { let row = await MongoDatabase.db("Authentication").collection("Credentials").findOne({ username: username }); if (!row) { return cb(null, false, { message: 'Incorrect username or password.' }); }
0
0
1
+ 3 other calls in file
GitHub: duokobia/passport-demo
46 47 48 49 50 51 52 53 54 55 56
return done(err); }; }) ); // passport.use( // new LocalStrategy((username, password, done) => { // User.findOne({ username: username }) // .then((user) => { // if (!user) {
0
0
0
7 8 9 10 11 12 13 14 15 16
module.exports = app => { // 初始化 Passport 模組 app.use(passport.initialize()) app.use(passport.session()) // 設定本地登入策略 passport.use(new LocalStrategy({ usernameField: 'email', passReqToCallback: true, // 設定為 true,讓 req 物件可傳入 callback 中 failureFlash: true // 加上這行,當驗證失敗時會自動將錯誤訊息存入 session }, (req, email, password, done) => {
0
0
0
+ 3 other calls in file
passport.authenticate is the most popular function in passport (419 examples)