mxstbr / passport-magic-login

Passwordless authentication with magic links for Passport.js.
MIT License
664 stars 45 forks source link

Unable to user req as NextApiRequest #30

Closed SuperstrongBE closed 1 year ago

SuperstrongBE commented 1 year ago

Hello i'm try to use passport-magic-login in a nextJS application.

in my call back i have this

export default async function handler(req: NextApiRequest, res: NextApiResponse) { passport.authenticate('magiclogin',async (err:any, payload:any) => { // ... doing auth stuff res.redirect('/test') })(req,res) }

But it throw an 500 error with next is not a function.

eric-burel commented 1 year ago

Check our open source setup at Devographics: https://github.com/Devographics/Monorepo/tree/61b0a929a89d8cbce93c56ee265ffd0cf4b5899d/surveyform/src/pages/api/account/magic-login

You passed a middleware with no "next" function I think