0

I am facing the issue where I am unable to get the sessionID in Safari. I am unable to get the session id in my further calls in localhost as well as in https calls.

Below code I am using in my server.js. In Chrome and Firefox it is working fine. Problem is in Safari only. I am using cookie-session package of node. Please help.

Boot.App.use(session({name: 'checkSession',keys: new Keygrip(['app-key-1'], 'SHA384', 'base64'),secure: false,httpOnly: true,domain: doc.Domain.ENV,maxAge: 31536000000}));

This is how i am creating a session

Boot.App.get('/set', function(req, res){req.session={checkSession:"user"};res.end(JSON.stringify("sessionSet"));});

But in further calls i am trying req.headers.cookie session id is coming undefined.

Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49

1 Answers1

0

This has been a known issue with Safari browser. What essentially happens is that Safari disables third party cookies by default. One has to go to the browser and enable it, obivously on an enterprise application you can't ask your users to do that.

There were known workarounds for this using iframes, for eg -

Safari 3rd party cookie iframe trick no longer working?

But apple has since circumvented these too.