I have a db row that has
{ uniqueId: 'dfklajh123' }
representing a user.
now, I want that user to be able to log in with the help of passport.js, and merge this uniqueId with the data returned from the session. For example:
User 1 is browsing inside my app, and decides to connect their account. He already has a uniqueId. When he gets callbacked using passport.js, the deserializeUser function is called, and at that moment I want to do some work like this (pseudo)
db.update(User).where(uniqueId: 'dfklajh123').insert(passportId: 'idFromPassport');
However, once the deserializeUser is called, I have no access to the uniqueId. How do I access this uniqueId from deserializeUser if I do not have access to the request?
In the examples, they write
passport.deserializeUser(function(id, done) { User.findById(id, function (err, user) { done(err, user); }); });
and this is where I want to access the uniqueId which I will send from the client, to match by, and update the user accordingly.
Any help is appreciated.