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

301
Views
Cómo verificar las cookies en _middleware en Next.js

Tengo un problema cuando uso _middleware en el próximo js, quiero obtener el token jwt y verificarlo en ese _middleware, ese es mi código:

 import {NextResponse} from "next/server"; import {verify} from "jsonwebtoken"; export async function middleware(req) { let { cookies } = req; let token = await cookies.jwt let url = req.url; if(url.includes('/dashbord')){ if(token === undefined) return NextResponse.redirect(process.env.NEXTAUTH_URL+'login'); try { verify(token,process.env.PASSWORD_SECRET); return NextResponse.next(); } catch (err) { return NextResponse.redirect(process.env.NEXTAUTH_URL+'login'); } } return NextResponse.next(); }

El código funciona muy bien en el host local, pero cuando lo implemento, me da un error **Error al compilar. ** Todas las variables ambientales están configuradas.

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!