Reputation: 1
I currently have an expres.js application that works well with a session system and I want to integrate a blog part on wordpress.
To do this, I redirect the requests that start for /blog to my wordpress and it works well.
On the other hand, I'm having trouble recovering my session. In express, when I execute this code, I recover the session content.
app.get('/header', async (req, res) => {
console.log("cookies",req.cookies)
console.log('session',req.session)
});
Result :
cookies {
plesk_technical_domain: '1',
'connect.sid': 's:e77xx-xx'
}
session Session {
cookie: {
path: '/',
_expires: 2026-02-12T07:29:15.590Z,
originalMaxAge: 31536000000,
httpOnly: true
},
flash: {},
userId: '8b199300-8ce2-41b4-a3c3-3d8766b00597'
}
But when I call this same url (from the same domain, so no cross-domain problem) express receives the connect.sid cookie, but it can't find the userId contained in the session...
cookies {
'wp-settings-time-1': '1739344846',
plesk_technical_domain: '1',
connect_sid: 's:e77xx-xx'
}
session Session {
cookie: {
path: '/',
_expires: 2026-02-13T06:15:06.897Z,
originalMaxAge: 31536000000,
httpOnly: true
},
flash: {}
}
I don't understand what the problem is. I'm receiving a cookie that is identical, so the session should be identical.
Upvotes: 0
Views: 18
Reputation: 1
The problem is that wordpress changed connect_sid to connect.sid and the cookie was not recognized.
Upvotes: 0