W
W
Wasya UK2016-12-27 21:28:22
Node.js
Wasya UK, 2016-12-27 21:28:22

How to get a session?

What could be wrong?

function (callback) {
                handshake.cookies = cookie.parse(handshake.headers.cookie || '');
                var sidCookie = handshake.cookies[config.get('session:key')];
                var sid = cookieParser.signedCookie(sidCookie, config.get('session:secret'));
                
                console.log(handshake.cookies); // { 'connect.sid': 's:CCPj8Xgmh7Quw5uwYIUjXaDyEde1wl8N.jgsBG0cy/RkJTul83dr4xjtEwZ/l0TGUEQf/phafRO8', io: 'xp0-fmaUzW8DIAulAAAA' }
                console.log(sidCookie); // undefined
                console.log(sid); // undefined
                
                loadSession(sid, callback);
            }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2016-12-27
@Arik

handshake.cookies['connect.sid']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question