mstade/passport-google-oauth2

passport-google-oauth2 + Clustering + SessionStore

Closed this issue · 2 comments

I am using strong-cluster-connect-store and strong-cluster-control npm modules to create an Express Cluster with Cross Cluster Session Storage.

So I have setup a LocalStrategy and a GoogleStrategy setup. And the LocalStrategy seems to be fine.
Once logged in on one worker, the others know of that session as well. However, when using the GoogleStrategy I only seem to be Authenticated for that worker.

My feeling is it is today with the store that is being used, internally. But I could be very much mistaken.

Any ideas/tips/tricks would be greatly appreciated.

I recommend you to use redis as session storage.

Agree with @mikefaraponov, session storage is best resolved with a dedicated solution. It could be in-memory, but that wouldn't work too well with instances going down and also probably makes clustering (i.e. the node kind) more difficult. An external service such as redis is a pretty typical setup for this sort of thing.