Answer the question
In order to leave comments, you need to log in
What should be passed to the token?
const result = jwt.verify(token, 'secret');
gives jwt malformed error. The problem seems to be in the token. what should be included in the token? do it via postman
Answer the question
In order to leave comments, you need to log in
If you use jwt, then it is immediately clear that you need to insert an active session token
For example. Authorization page for example /login/ should return a token
const token = jwt.sign(
{ userId: id },
config.get('jwtSecret'),
{ expiresIn: '24h' }
)
res.json({ token })
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question