Skip to content
RED SAG Skills
medium10 pts · first answer countsauthenticationjwt

Reading the role from a token

What is wrong with this middleware?

const payload = jwt.decode(req.headers.authorization.slice(7))
if (payload.role === 'admin') return next()
res.sendStatus(403)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions