Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I consolidate session management using Sails.js and Stormpath?

I'm investigating using Stormpath for our user Management.

I currently have a Sails.js application which uses Node.js / Express.js. Currently, session management is handled by the default Sails.js framework, which relies heavily on Express' session middleware.

Sessions are stored in a shared Redis database on production so that we can keep our multiple API servers stateless.

My question is will the two session management systems conflict and/or cause bugs? Do they have to be consolidated or can we safely keep them separate? if they have to be combined, how do you configure the middleware?

As a note we won't be storing much user data on Stormpath, we'll only be using them as a auth/token provider.

Thanks for the help!

like image 516
Shaheen Ghiassy Avatar asked Apr 04 '15 18:04

Shaheen Ghiassy


1 Answers

I'm the author of the express-stormpath library, which is what I'm assuming you're evaluating.

You can indeed use your own sessions in addition to the stormpath ones. The way it works is like so:

Stormpath uses req.session to store a stormpathSession cookie. Any other cookies you create / store, will be handled by you completely.

It should work nicely with whatever session library you choose =)

like image 147
rdegges Avatar answered Oct 19 '22 04:10

rdegges