Error and Success Handler for Passport.js

Overview

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();
    }
}));
You might also like...

Passport NFT using on-chain metadata

Passport NFT Collection Setup yarn Environment File (.env) RINKEBY_URL: Ethereum (Rinkeby) Testnet Provider endpoint MATIC_URL: Polygon (Matic Mumbai)

Jun 2, 2022

FACEIT (OAuth2) authentication strategies for Passport.

passport-faceit FACEIT is a trademark or registered trademark of FACEIT LIMITED in the U.S. and/or other countries. "@ambergg/passport-faceit" is not

Oct 26, 2022

1kb js library contains development debugging, error monitoring and reporting, user problem localization features

1kb js library contains development debugging, error monitoring and reporting, user problem localization features

1kb js library contains development debugging, error monitoring and reporting, user problem localization features

Dec 22, 2022

Webpack dev tools to make performance analysis, error investigation and loader development more convenient

Webpack dev tools to make performance analysis, error investigation and loader development more convenient

build-tool-inspector Introduction Webpack dev tools to make performance analysis, error investigation and loader development more convenient. Provide

Nov 17, 2022

Unstyled, dev error overlays for SolidJS

Unstyled, dev error overlays for SolidJS

solid-error-overlay Unstyled, headless Error Overlay for SolidJS Install npm i solid-error-overlay yarn add solid-error-overlay pnpm add solid-error-o

Dec 29, 2022

A Little explanation of the famous Javascript parseInt(0.0000005); error meme.

A Little explanation of the famous Javascript parseInt(0.0000005); error meme.

Explaining the meme Internet is made of millions of memes flowing everyday, so, devs create a ton of new images showing how their code doesn't work, t

Feb 3, 2022

Polyfill `error.cause`

Polyfill error.cause. error.cause is a recent JavaScript feature to wrap errors. try { doSomething() } catch (cause) { throw new Error('message',

Dec 15, 2022

VS Code extension that adds a red error squiggle to every word in your code.

VS Code extension that adds a red error squiggle to every word in your code.

Dumbisense Dumbisense is a VS Code extension that adds a red error squiggle to every word in your code, with an interesting error message and dino ima

Sep 3, 2022

New Discord.JS v14 Slash and Prefix Commands handler with Events. Check it out now!

New Discord.JS v14 Slash and Prefix Commands handler with Events. Check it out now!

Discord.js v14 Command-Handler Commands, Events, Permissions and Cooldown Handlers for Discord.js v14 bot ~ Made by Lynx Discord.js v14 (dev version)

Dec 19, 2022
Owner
Swôth
hallo!
Swôth
Colorconsole provides an interesting way to display colored info, success, warning and error messages on the developer console in your browser

ColorConsole NPM Package Colorconsole provides an interesting way to display colored info, success, warning and error messages on the developer consol

Hasin Hayder 17 Sep 19, 2022
GraphErr is an open-source error handling library for GraphQL implementations in Deno. It's a lightweight solution that provides developers with descriptive error messages, reducing ambiguity and improving debugging.

GraphErr Descriptive GraphQL error handling for Deno/Oak servers. Features Provides additional context to GraphQL's native error messaging for faster

OSLabs Beta 35 Nov 1, 2022
💣 Error handler for CLI applications 💥

Error handler for CLI applications. Features ?? Error type-specific handling ?? Graceful exit ⛑️ Normalize invalid errors ?? Log verbosity: full, shor

ehmicky 13 Dec 20, 2022
DiscordJs13-handler is the solution for all the discord.js developper who want a complete handler for slash commands

DiscordJs13-handler is the solution for all the discord.js developper who want a complete handler for slash commands

null 9 Jul 2, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A handy-dandy JS shim to run OreUI files in your browser (to varying degrees of success.)

OreUIShim (C) Luminoso 2022 / MIT Licensed. Contributions Welcome! A small shim JS file to experiment with oreUI in the browser. How to use Prerequisi

null 12 Dec 8, 2022
👽 This is a tutorial for integrating Casbin and Passport.

passport-combine-casbin but not only casbin passport-combine-casbin-react:前端应用(vite + react 17): 跳转链接 技术选型 基础:Midway.js ✅ ORM: prisma ✅ DB: mongoDB(需要

xiaoqinvar 6 Nov 22, 2022