passport-handler
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i passport-handler

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

3.35 kB

Total Files

4

Last publish

Collaborators

  • swoth