passport-handler
❤️ by Swôth
Developed with
🔎 Installation
npm i passport-handler --save
yarn add passport-handler
🔮 Importing
import Handler from 'passport-handler'; // esm
const Handler = require('passport-handler').default; // commonjs
✨ Setup
import Handler from 'passport-handler';
import passport from 'passport';
// passport strategy and others...
app.get('/auth/callback', Handler(passport.authenticate('provider'), {
error: (err, req, res, next) => {
console.log(err.message);
next();
},
success: (req, res, next) => {
// if you don't add this function, next() will run automatically
console.log('successful');
next();
}
}));