koa-passport Authentication Always Returns 4XX

我是研究僧i 提交于 2020-04-30 11:21:45

问题


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

passport.authenticate( 'local', {
    successRedirect: '/',
    failureRedirect: '/login',
    failureFlash: true
} );

回答1:


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


来源:https://stackoverflow.com/questions/57128108/koa-passport-authentication-always-returns-4xx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!