{"action":"created","issue":{"url":"https://api.github.com/repos/ga-dc/project3/issues/67","labels_url":"https://api.github.com/repos/ga-dc/project3/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/ga-dc/project3/issues/67/comments","events_url":"https://api.github.com/repos/ga-dc/project3/issues/67/events","html_url":"https://github.com/ga-dc/project3/issues/67","id":121253628,"number":67,"title":"Errors with flash & passport","user":{"login":"schersh","id":13408456,"avatar_url":"https://avatars.githubusercontent.com/u/13408456?v=3","gravatar_id":"","url":"https://api.github.com/users/schersh","html_url":"https://github.com/schersh","followers_url":"https://api.github.com/users/schersh/followers","following_url":"https://api.github.com/users/schersh/following{/other_user}","gists_url":"https://api.github.com/users/schersh/gists{/gist_id}","starred_url":"https://api.github.com/users/schersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schersh/subscriptions","organizations_url":"https://api.github.com/users/schersh/orgs","repos_url":"https://api.github.com/users/schersh/repos","events_url":"https://api.github.com/users/schersh/events{/privacy}","received_events_url":"https://api.github.com/users/schersh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-09T14:30:30Z","updated_at":"2015-12-09T14:37:06Z","closed_at":null,"body":"I'm experiencing several errors with implementing passport, which all seem to be interconnected with flash messages, \"next\" function, and users not being saved to our database (currently they seem to just be saved into a session). \r\nAs I alter the code, I hit several different errors - the first is a command line error: \r\n```\r\nif (this.session === undefined) throw Error('req.flash() requires sessions');\r\n                                  ^\r\nError: req.flash() requires sessions\r\n    at Error (native)\r\n```\r\n\r\nI do have flash and sessions required in my index.js file: \r\n```js\r\nvar express     = require('express')\r\nvar flash       = require('connect-flash');\r\napp.use(passport.initialize());\r\napp.use(passport.session());\r\napp.use(flash());\r\n```\r\n\r\nWhen I comment out the flash messages, I'm able to create a user and log-in, but when I attempt to log-in a second time, I hit a different error in the browser that says next is not a function, and the stack trace references the authenticate.js file.  \r\n\r\nI do have \"next\" entered as an argument and callback (I think) in my app.use function and both the postSignup and postLogin functions: \r\n\r\n```js\r\napp.use(function (req, res, next) {\r\n    res.locals.currentUser = req.user;\r\n    next();\r\n  });\r\n\r\n  function postSignup(request, response, next) {\r\n    var signupStrategy = passport.authenticate('local-signup', {\r\n      successRedirect : '/',\r\n      failureRedirect : '/signup',\r\n      failureFlash : true\r\n    });\r\n    return signupStrategy(request, response, next);\r\n  }\r\n```\r\n\r\nSorry if this is too much to post for one issue - thanks in advance!"},"comment":{"url":"https://api.github.com/repos/ga-dc/project3/issues/comments/163265472","html_url":"https://github.com/ga-dc/project3/issues/67#issuecomment-163265472","issue_url":"https://api.github.com/repos/ga-dc/project3/issues/67","id":163265472,"user":{"login":"schersh","id":13408456,"avatar_url":"https://avatars.githubusercontent.com/u/13408456?v=3","gravatar_id":"","url":"https://api.github.com/users/schersh","html_url":"https://github.com/schersh","followers_url":"https://api.github.com/users/schersh/followers","following_url":"https://api.github.com/users/schersh/following{/other_user}","gists_url":"https://api.github.com/users/schersh/gists{/gist_id}","starred_url":"https://api.github.com/users/schersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schersh/subscriptions","organizations_url":"https://api.github.com/users/schersh/orgs","repos_url":"https://api.github.com/users/schersh/repos","events_url":"https://api.github.com/users/schersh/events{/privacy}","received_events_url":"https://api.github.com/users/schersh/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T14:37:06Z","updated_at":"2015-12-09T14:37:06Z","body":"Is the order important?"}}