I am using socket.io’s authorize method( In detail here) to check whether the user is authorized to use my app by checking the cookie associated with the user.
The above blog post is fairly straight forward but I am using cookieSessions to store session data in cookies. One good question is on stackoverflow but I can’t figure that out.
I want to know how to decrypt cookieSession data to access the session data. A bit of my sample code:
io.set('authorization', function (data, accept) {
//Check cookie for session data
accept(null, true);});
In other words, how can I access the cookieSession in socket.io?
I use the following (with passport, but it doesn’t matter):
and getCookieSession is the following module: