Search code examples
node.jssails.jssid

nodejs sails : the sails.sid variable return undefined


I cant access to sails sid by default sails.sid variable

here is my config.session

module.exports.session = {

  secret: 'f67cffdb3b2dc70c200a9e8bf3a16cac',

  // isSessionDisabled: function (req){
  //   return !!req.path.match(req._sails.LOOKS_LIKE_ASSET_RX);
  // },

};

when i do console.log(sails.sid) i get undefined


Solution

  • The session object can be accessed through the request object e.g.

    req.session
    

    and also through the global sails object

    sails.session