与护照js使用风帆

我正在使用护照js进行authentication。 我已经在下面的链接中的代码,以供参考。

http://blog.thesparktree.com/post/77311774912/creating-a-sails-application-using-passport

我正在尝试使用用户凭据login,但它不起作用。 我已根据注释对中间件进行了更改,并在http.js中插入了代码,但是login未得到authentication。 请让我知道我要去哪里错了,还有什么其他的改变。

我已经在Git Hub上上传了这个项目。 请检查我是否犯了致命错误。

https://github.com/kchodankar/SailsTest

你的问题有点古怪,但在研究类似的问题的时候出现了。 看看你的repo,在https://github.com/kchodankar/SailsTest/blob/master/config/http.js中 , passportInitpassportSession需要在order堆栈中,这样当中间件堆栈被使用时,护照将被调用/启动调用。

 passportInit: require('passport').initialize(), passportSession: require('passport').session(), order: [ 'startRequestTimer', 'cookieParser', 'session', 'passportInit', // <===== passportInit 'passportSession', // <===== passportSession 'bodyParser', 'handleBodyParserError', 'compress', 'methodOverride', 'poweredBy', '$custom', 'router', 'www', 'favicon', '404', '500' ]