Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
Obteniendo un error al solicitar una actualización de detalles de usuario como No se pueden leer las propiedades de undefined (leyendo 'id')

Esta es mi solicitud de actualización para actualizar un usuario, pero el título es el resultado que obtengo

 router.put("/:id", verifyTokenAndAuthorization, async (req, res) => { if (req.user.password) { req.body.password = CryptoJS.AES.encrypt( req.body.password, process.env.PASS_SEC ).toString(); } try { const updatedUser = await User.findByIdAndUpdate( req.user.id, { $set: req.body, }, { new: true } ); res.status(200).json(updatedUser); } catch (err) { res.status(500).json(err); } });

Pero la solicitud no pasa

 const verifyTokenAndAuthorization = (req, res, next) => { verifyToken(req, res, () => { console.log("req recived for login"); if (req.user.id === req.params.id || req.user.isAdmin) { console.log("req went past verification"); next(); } else { res.status(403).json("You are not allowed to access!"); } }); };

el problema está antes de que el requisito de salida pasara la verificación

Esto está impreso en mi consola.

solicitud recibida para el error de inicio de sesión = "No se pueden leer las propiedades de undefined (leyendo 'id')" en E:\E-com Project\ver-one-zero-one-api\routes\verifyToken.js:20:18

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!