title: Multiple Express with express-session Applications on Single Server, Different Ports
body: <p>I am running multiple MEAN applications using express-session on a single server under multiple ports. When I authenticate into application A, the established token for the other (application B) is modified. The authenticated user session for application B is then denied.</p>
  
  <p>How do I configure all of my applications to persist and verify tokens independently? For example, on localhost, application A runs on port 80, and application B runs on port 90. I want a user to be able to authenticate and use application A without disrupting another user's Application B session.</p>
  
  <p>Here is the code in my app.js file that should be relevant to my issue:</p>
  
  <pre><code>// Connect to database
  mongoose.connect(config.mongo.uri, config.mongo.options);
  
  var connection = mongoose.createConnection(config.mongo.uri, config.mongo.options);
  
  var app = express();
  
  // enable CORS
  app.use(cors());
  
  // enable cookieParser
  app.use(cookieParser());
  
  // enable session
  app.use(session({
      secret: config.secrets.session,
      resave: false,
      saveUninitialized: true,
      name: 'uniqueSessionId',
      store: new MongoStore(
          {
              mongooseConnection: connection
          }
      )
  }));
  </code></pre>