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

166
Views
problema de la función de cierre de sesión del nodo js cuando se implementa vercel

Hola, tengo un sitio web creado en html, css y nodejs, antes de implementar vercel, implementé mis aplicaciones en heroku y localhost e intenté ejecutarlas y todo funciona perfectamente, pero cuando implemento vercel`` mi aplicación e intento cerrar sesión en el nodo js, mi sitio web es simplemente actualice la página a veces, cierre la sesión, pero en su mayoría actualice la página y no elimine el token jwt y no cierre la sesión de Node-js

 const logout = async(req,res,next) => { try { res.clearCookie("jwt") await req.user.save() } catch (error) { res.json(error) } }

y mi ruta de inicio de sesión

 const loginUser = async(req,res,next) => { const {nickname, password,phone} = req.body const user = await User.findOne({ nickname, }) if(await bcrypt.compare(password,user.password)) { const token = jwt.sign({ id:user._id, nickname:user.nickname, role:user.role }, process.env.JWT_SECRET ) res.cookie('jwt', token, { expires: new Date(Date.now() + 3000000), httpOnly: true }) return res.json({status: 'ok', data:token}) } return res.json({status: 'error', error: 'Böyle bir kullanıcı adı/şifre bulunamadı!'}) }
about 4 years ago · Juan Pablo Isaza
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!