avian
avian

Reputation: 353

Persistent Session with passportjs + sails.js Implementation

Can anyone point me to a link or explain how to implement persistent sessions with passportjs in sails.js. I know it involves connect-mongo but was not really familiar on how to implement it. Session gets destroyed every time nodejs restarts.

Please shed some light.

Thanks.

Upvotes: 1

Views: 615

Answers (2)

mateeyow
mateeyow

Reputation: 1356

All you have to do is to install connect-mongo npm install connect-mongo --save then uncomment the adapter, host, port, db and collection objects on your config/session.js.

That's all mate!

Upvotes: 2

Aurélien Thieriot
Aurélien Thieriot

Reputation: 5923

The configuration to change is in the file config/session.js.

Basically you can change the adapter property for either mongo or redis and provide a connection URL.

There is more explanations here: http://beta.sailsjs.org/#/documentation/reference/Configuration/Session.html

P.S: In fact, using Passportjs or not as little to do with how the session is stored by Sails

Upvotes: 0

Related Questions