{"action":"created","issue":{"url":"https://api.github.com/repos/jfromaniello/passport.socketio/issues/110","labels_url":"https://api.github.com/repos/jfromaniello/passport.socketio/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/jfromaniello/passport.socketio/issues/110/comments","events_url":"https://api.github.com/repos/jfromaniello/passport.socketio/issues/110/events","html_url":"https://github.com/jfromaniello/passport.socketio/issues/110","id":109693161,"number":110,"title":"\"Passport was not initialized\" when using Passport 0.3.0 and Socket.io 1.3.6","user":{"login":"patrickpilch","id":2015295,"avatar_url":"https://avatars.githubusercontent.com/u/2015295?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickpilch","html_url":"https://github.com/patrickpilch","followers_url":"https://api.github.com/users/patrickpilch/followers","following_url":"https://api.github.com/users/patrickpilch/following{/other_user}","gists_url":"https://api.github.com/users/patrickpilch/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickpilch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickpilch/subscriptions","organizations_url":"https://api.github.com/users/patrickpilch/orgs","repos_url":"https://api.github.com/users/patrickpilch/repos","events_url":"https://api.github.com/users/patrickpilch/events{/privacy}","received_events_url":"https://api.github.com/users/patrickpilch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-04T17:42:38Z","updated_at":"2015-10-19T01:00:26Z","closed_at":null,"body":"I am unable to get this library to work properly. My authorization failure callback is always called from the library's index.js file at line 75\r\n``` javascript\r\nif(!session[auth.passport._key])\r\n        return auth.fail(data, 'Passport was not initialized', true, accept);\r\n```\r\n\r\nHere is the code related to my setup\r\n``` javascript\r\nvar session = require('express-session');\r\nvar sessionStore = new RedisStore( { client:redis } );\r\nvar RedisStore = require('connect-redis')(session);\r\n// ...\r\napp.use( session({\r\n        store: sessionStore,\r\n        secret: 'such secret wow',\r\n        resave: false,\r\n        saveUninitialized: true //TODO change to false\r\n    })\r\n);\r\n// ...\r\napp.use(passport.initialize());\r\napp.use(passport.session());\r\nvar server = http.createServer(app);\r\nvar sockets = require('socket.io')(server);\r\nsockets.use(PassportSocketIo.authorize({\r\n    key: 'connect.sid',\r\n    secret: 'such secret wow',\r\n    store: sessionStore,\r\n    success: onAuthorizeSuccess,\r\n    fail: onAuthorizeFail\r\n}));\r\n```"},"comment":{"url":"https://api.github.com/repos/jfromaniello/passport.socketio/issues/comments/149070476","html_url":"https://github.com/jfromaniello/passport.socketio/issues/110#issuecomment-149070476","issue_url":"https://api.github.com/repos/jfromaniello/passport.socketio/issues/110","id":149070476,"user":{"login":"patrickpilch","id":2015295,"avatar_url":"https://avatars.githubusercontent.com/u/2015295?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickpilch","html_url":"https://github.com/patrickpilch","followers_url":"https://api.github.com/users/patrickpilch/followers","following_url":"https://api.github.com/users/patrickpilch/following{/other_user}","gists_url":"https://api.github.com/users/patrickpilch/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickpilch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickpilch/subscriptions","organizations_url":"https://api.github.com/users/patrickpilch/orgs","repos_url":"https://api.github.com/users/patrickpilch/repos","events_url":"https://api.github.com/users/patrickpilch/events{/privacy}","received_events_url":"https://api.github.com/users/patrickpilch/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T01:00:26Z","updated_at":"2015-10-19T01:00:26Z","body":"@willshiao \r\nI ended up not using this library in favor of this route: http://stackoverflow.com/a/25618636\r\nMy setup:\r\n```javascript\r\nvar session = require('express-session');\r\nvar sessionMiddleware = session({\r\n    store: sessionStore,\r\n    secret: 'such secret wow',\r\n    resave: false,\r\n    saveUninitialized: false\r\n});\r\n\r\nsockets.use(function(socket, next) {\r\n    sessionMiddleware(socket.request, socket.request.res, next);\r\n});\r\n```"}}