Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
Connecting passport.js data with an existing entry in DB

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.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda