1.0.2 • Published 2 years ago

passport-handler v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm install npm version

🔎 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();
    }
}));