Empty Passport session after loggin in ajax

after covering 150 pages, my problem is not solved . I think my session does not register , as if I had not put the ” session_start ()” in php .

My login route is calling in ajax and req.login() return to me true, serializeUser is called. Here, console.log(req.session.passport) is good, because there is no refresh page.

On the next page i call by ajax a simple method to check if i’m logged but my session.passport is empty and deserializeUser is never call.

Here my console.log(req.session) :

{ cookie: 
   { path: '/',
     _expires: Fri Jun 26 2015 14:42:11 GMT+0200 (CEST),
     originalMaxAge: 18000000,
     httpOnly: false,
     secure: false 
  passport: {} 

And my console.log(req.cookie) :

{ PHPSESSID: 'f0f99f8580bd869776f571f8f8b93e7e',
  KEY: 's:af3f109d-93c0-4721-9bc7-bde12b7ff55e.yLL5y5m6zNZbuf3Y0+2RWSJ7Mx76cQAKm04rJMmDT1U' }

I read that it’s better to configure “httpOnly” at false for ajax calling.

Thank’s for your help and i hope that this day will be a good day !

Source: ajax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.