title: Logging in to one Express app destroys session in other (same server)
body: <p>I have two separate Express 4.x apps running on the same server machine (different ports), sharing a MongoDB instance. They both use different databases and have different session secrets.</p>
  
  <p>I am able to log into application A or B individually without issue. My session is maintained and all is well. However, if I am logged into A and then log into B, my session in A is destroyed (and vice versa).</p>
  
  <p>Both applications have near-identical local auth. Their <code>serializeUser</code> and <code>deserializeUser</code> is very primitive (following the Passport docs almost to the tee).</p>
  
  <p>It seems that when logging into A then B, <code>req.session.passport</code> is destroyed, causing <code>req.user</code> to not serialize properly on app A and the session is considered invalid.</p>
  
  <p>I'm starting to think it has to do with the fact both apps run on the same machine (thus domain), differing only by a port.</p>