After setting up the route to send a JWT with a cookie, I'm unable to see it in my browser.
Here's the code for the route:
router.post('/signup', async (req, res) => {
const { email, password } = req.body
try {
const user = await User.create({ email, password })
const token = createToken(user._id)
res.status(201).cookie('jwt', token, { httpOnly: true, maxAge: maxAge * 1000 })
} catch (err) {
const errors = handleErrors(err)
res.json({ errors })
}
})
Despite confirming that the server is functioning correctly and that the token size is under 4kb, the 'jwt' cookie does not appear in the Chrome application tab.
The express version being used is 4.17.1.