1

When using koa-passport I am always receiving a 404 or 401 error.

passport.authenticate( 'local', {
    successRedirect: '/',
    failureRedirect: '/login',
    failureFlash: true
} );
bicarlsen
  • 1,241
  • 10
  • 27

1 Answers1

2

(This gave me many hours of struggle so wanted to post it here for others.)

When using koa-passport you must be sure to both return the result of the authentication, and call authenticate with the context.

return passport.authenticate( 'local', {
    successRedirect: '/',
    failureRedirect: '/login',
    failureFlash: true
} )( ctx );
bicarlsen
  • 1,241
  • 10
  • 27