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

189
Views
NodeJS req.headers undefined after send JWT token on headers

login endpoint:

 res.header("authorization", accessToken).send(accessToken)
 const user = await prisma.user.findFirst({
    where: {
      email: req.body.data.email,
    },
  });
  const accessToken = jwt.sign(
    user,
"my secret token there"
  );
 if (!user) return res.sendStatus(400).send("Email doesnt exist");
  res.header("authorization", accessToken).send(accessToken)
router.get("/getAccountInfo", authenticateToken, getAccountInfo);

middleware authenticateToken :

export const authenticateToken = (
  req: Request,
  res: Response,
  next: NextFunction
) => {
const authHeader = req.headers["authorization"];
...more code
}

authHeader is undefined

in login endpoint headers see authorization but middleware doesnt

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!