after a successful authentication with Passport.js, I want a redirect to the user's profile page. However, after the redirect, the value of `req.user` is set to the first record of the database. So all users see user /1's profile page, instead of the intended page, let's say /33. 

How can I keep the information of the session and `req.user` consistent during a redirect?

The web app is express.js 4.0, and sequelize.js 2.0, and postgres 9.4. Full code is here: <https://github.com/skilbjo/dropkey> 

`routes.js` file

```
// Users ==========================
  app.route('/users/:id([0-9]+)')
    .get(function(req, res) { 
      controller.users.show(req, res, model); 
    });

// Dropbox
  app.route('/auth/dropbox')
    .get( passport.authenticate('dropbox-oauth2') );
  app.route('/auth/dropbox/callback')
  .get(function(req, res) { passport.authenticate('dropbox-oauth2')(req, res, function() {
      res.redirect('/users/' + req.user[0].dataValues.UserId)(req);
    });
  });

```

`passport.js` file

```
passport.serializeUser(function(user, done) {
    return done(null, user);
});

passport.deserializeUser(function(id, done) {
    User.find(id)
    .complete(function(err, user) {
        return done(err, user);
    });
});

// Dropbox
passport.use(new DropboxOAuth2Strategy({
    clientID                : process.env.DROPBOX_KEY,
    clientSecret        : process.env.DROPBOX_SECRET,
    callbackURL         : process.env.DROPBOX_CALLBACK
},
function(accessToken, refreshToken, profile, done) {
    User.findOrCreate({where: { 
        DropboxId: profile.id,
        DropboxToken: accessToken,
        Name: profile.displayName,
        Email: profile.emails[0].value          
    }})
    .complete(function(err, user) {
        if (err) return done(err);
        if (user) {
            return done(null, user);
        } 
    });
}

```

`logs`

```
GET /auth/dropbox 302 3.727 ms - 0
Executing: SELECT "UserId", "DropboxId", "DropboxToken", "Name", "Email" FROM "User" AS "User" WHERE "User"."DropboxId" = // blah blah
[ 
    { dataValues:
      { 
            UserId: 33, // this is correct
            DropboxId: //correct,
            DropboxToken: //correct
        }
    }
]

```

that's all correct... but then on the redirect, even though the endpoint is /33 (not /1), and the information passed as the req.user is for user 1 

`logs`

```
GET /auth/dropbox/callback?code=OTsdk-213 302 1266.986 ms - 74
Executing (default): SELECT "UserId", "DropboxId", "DropboxToken", "Name", "Email" FROM "User" AS "User";
[
    { dataValues:
        {
            UserId: 1,  // not the correct user!
            DropboxId: // information for user /1, when I want /33
            DropboxToken: // information for user /1, when I want /33
        }
    }
] 

```