Note that there are some explanatory texts on larger screens.

plurals
  1. PODo I implement serialize and deserialize NodesJS + Passport + RedisStore?
    primarykey
    data
    text
    <p>Do I implement Serialize and Deserialize? </p> <p>RedisStore is setup as my session store with Express. Does this mean that I DO NOT implement Serialize and Deserialize? Will it happen automatically? </p> <p>When I don't implement these methods I get the following Express error - 500 Error: failed to serialize user into session. When I do implement them I'm not sure what to put in the Deserialize. </p> <p>The code below appears to work but the sessions are not persisting. I need to login everytime I visit the site. </p> <p>Is there a good example anywhere of NodeJS + Passport + RedisStore? </p> <pre><code>var sessionStore = new RedisStore({ host: rtg.hostname, port: rtg.port, db: redisAuth[0], pass: redisAuth[1] }); passport.use(new ForceDotComStrategy({ clientID: clientId, clientSecret: clientSecret, callbackURL: myurl }, function(token, tokenSecret, profile, done) { console.log(profile); return done(null, profile); } )); appSecure.configure('production', function(){ appSecure.use(allowCrossDomain); appSecure.use(express.cookieParser(expressSecret)); appSecure.use(express.bodyParser()); appSecure.use(express.methodOverride()); appSecure.set('port', port); appSecure.use(express.session({ secret: expressSecret, store: sessionStore, key:'expressSid', cookie: { maxAge : 604800, domain:'.domain.com'}})); appSecure.use(passport.initialize()); appSecure.use(passport.session()); appSecure.use(appSecure.router); appSecure.use(express.static(__dirname + '/public')); appSecure.use(express.errorHandler()); }); passport.serializeUser(function( user, done ) { done( null, user.id); }); passport.deserializeUser(function( user, done ) { done( null, user ); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload