Skip to content

Swothh/passport-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-handler

Developed with ❤️ by Swôth

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

About

📖 Error and Success Handler for Passport.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published