passport.js - Session update on client-side routing in isomorphic ReactJS apps -
i building isomorphic web app following tools:
- expressjs server
- nextjs universal reactjs implementation , routing
- passportjs authentication local strategy
- redux storing logged-in user's data
- mongodb mongoose database needs
- redis session storage
right now, i've been able implement user login/authentication system. user logs in , stays authenticated connect.sid
cookie seeded passport. works great since session gets updated and, unless user has logged out deliberately, stays persistent. however, problem client-side routing. how ensure session updates when there's no server request case csr?
the way things stand now, log in 1 user in 1 browser tab , in second tab and, long don't refresh (thus triggering server request), have 2 user accounts active simultaneously on client side in same browser!
what best way add kind of client-side session update such use-cases? think of seeding second cookie user data, such username, first name, last name, etc. during login , updating each logout/login event browser tabs have up-to-date information. doesn't sound super secure way things!
the project code can accessed @ https://github.com/amitsch666/nano
the site in question live @ http://54.197.22.181 , try logging in using following test credentials in order replicate problem:
username: mark
password: ted
Comments
Post a Comment