Replies: 2 comments
-
If you look at the express-session source code for the
If you're using one of the compatible stores provided in the documentation 1 is probably not the case. It could be that the initial request from your socket is not sending your session cookie on connection. So when it reaches the express-session middleware in the |
Beta Was this translation helpful? Give feedback.
-
I have the same problem with passportJS, socket io and session in express, i have a web page that use express, nodejs, mongodb, with passport as authentication, i want to integrate socket io but i can´t set the same session id of socket as session after login, before login, there is a session id in socket request but there is not saved in mongo store, after login, one session is created on database but it has not the same id of the socket session id, what can it be the problem? Im stuck here, please help! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Here's the setup...
Localhost, SSL, Proxy, Express, Express Session, Connect-MongoDB-Session, React
Two apps:
Everything seems to be working fine. SSL is good, fetch is good, mongoDB is good, IO connection is good, works fine.
What doesn't work is reloading the session prior to event use in socket io on the host sever (app 1).
socket.use((__, next) => { session.reload((err) => { if (err) { console.error(err) } else { next() } }) })
Is throwing this error:
Error: failed to load session
The session seems to be working just fine, however, storing variables and so on. Reload keeps the same session, etc. Cookies are all good. CORS is all good.
But I keep getting the vague
Error: failed to load session
error and I'm stopped in my tracks.The socket connection works just fine otherwise and can execute events. But it can't reload the session.
Anyone have an idea of what is going?
Beta Was this translation helpful? Give feedback.
All reactions