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

251
Vistas
Nodejs user profiles and sessions

The goal is to build a user profile system for my web application. A user would be able to login, maintain a session and see his profile. After reading various tutorials online about how to do this, I feel a bit lost. Everyone uses different libraries and as someone new to web development, it's not clear what each library does. I've seen the following libraries used, can someone explain the flow of user-profile interactions and where each library comes in?

passport
passport-local
bcrypt-nodejs
connect-flash
express-session

jsonwebtoken
express-jwt

morgan
cookie-parser
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

One way to start your learning can be at: https://www.youtube.com/watch?v=Z1ktxiqyiLA There I learned how to use the most of plugins from your question.

Ok so about the plugins:

  • passport passport is a node.js plugin which is used usually with express that works as a middleware responsible for the authorization and authentication

  • passport-local - is a plugin for passport, more technically a strategy of authentication which usually is used with a database or configuration file.

  • bcrypt-nodejs is used usually for crypting the passwords in the database (but it is much more powerfull than that), is not cool to save password in plain text.

  • connect-flash - is used for flash messages that appears on a page "The user was successfully added", "Invalid user credentials", or any other success or error messages that you want to display on a page.

  • express-session - is an express middleware which is responsible to store the user session.

  • jsonwebtoken - jwt is used to create a token which you will use to identify if an user was authenticated or not.

  • express-jwt - an express middleware for jsonwebtoken

  • cookie-parser - an express middleware to parse cookies

  • morgan - just a log-ing service.

Ok so you should understand a bit of theory here:

  • passport with passport-local strategy is a statefull authentication mechanism which is supposed to save if the user is authenicated or not in a session, if you restart the node.js server if you did not persist your sessions in a third party service as a database/file etc... you will lose the sessions.

  • jsonwebtoken is a stateless authentication mechanism, you do not need to save anything on your server only the "secret key". Stateless architecture has some cool pros as it promotes horizontal scalability you can have endless nodes which will know how to parse the sended token and understand if the user is logged in or not. Lately I go with jwt as authentication.

about 4 years ago · Santiago Trujillo Denunciar
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