enter image description hereenter image description hereHow can I set the token in the local storage?now it is sent in the response body, should I use res.setheader?and if yes what to insert to it the token so that it will be set to local storage?
const token = jwt.sign({
name: result[0].name
},
'somesupersecretsecret', {
expiresIn: '1h'
}
);
res.status(200).json({
token: token,
userId: "userid"
})
.catch(err => {
if (!err.statusCode) {
err.statusCode = 500;
}
next(err);
});
}
});