title: express-session - the difference between session id and connect.sid?
body: <p>What the difference between <code>session id</code> and <code>connect.sid</code>?</p>
  
  <p>For example:</p>
  
  <pre><code>console.log('session id =', req.sessionID)
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>session id = CCw2pSpdPf8NRKLQpFH-nlFztEzps24Q 
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>console.log('req.headers =', req.headers)
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>req.headers = {                                                                                                                                         20:51:34
    host: 'localhost:3000',
    connection: 'keep-alive',
    'cache-control': 'max-age=0',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' +
      '(KHTML, like Gecko) Chrome/73.0.3683.75 ' +
      'Safari/537.36',
    dnt: '1',
    accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
    cookie: 'connect.sid=s%3ACCw2pSpdPf8NRKLQpFH-nlFztEzps24Q.P04Tx%2FNboFGXvR34HOjpbeh4ogWy58zs%2Bpyde%2FkuUVs',
    'if-none-match': 'W/"2f-u+/xADzzu5HL7bySP/YXVKZBlPc"'
  }
  </code></pre>
  
  <p><code>CCw2pSpdPf8NRKLQpFH-nlFztEzps24Q</code> is different from <code>connect.sid</code></p>
  
  <p>How do I use them in a middleware to verify the user?</p>