able to store session in mongodb but in react router I am able to navigate to private routes if I navigate through history.push() but if I change url directly and reload then I am directly logged out and redux loggedIn state is reset how can I avoid this scenario?
In my case connect.sid which is a cookie is stored in browser when user logins but if I refresh page then redux state is reset and due to which user is navigated to login again
using redux persist will solve the problem or is it not required in this case?
This is actually an interesting problem of React
oh ok can you let me know how can it be done any suggestions?
@lprapp getting this issue thats why I asked
You could store the authentication data on the localStorage so it persists on a reload event. Just remember to don't abuse the localStorage use. Try to keep it simple since some user could disabled it
in my case I think I dont even require localstorage as I am using httpOnly cookie session based auth using passportjs
Well, I haven't use sessions, just jwt, so i don't have the knowledge to help you either, sorry
you can read this later: https://gist.github.com/samsch/0d1f3d3b4745d778f78b230cf6061452
Обсуждают сегодня