Cookie can't be set server-side with nodeJS

69
June 06, 2019, at 5:00 PM

I use the simple way to create cookie but it just doesn't work.

My code is like this :

router.post('/auth', function(req, res, next){
    ...
       res.cookie('access_token', 'test')
       console.log(req.cookies)
    ...
})

I can get the token client-side. But the console.log says 'undefined'

READ ALSO
javascript node.js read form fields into mongoose schema hooks

javascript node.js read form fields into mongoose schema hooks

I would like to read variables obtained from form post in nodejs/express

50
How to test correct data validation with Mocha using Loopback?

How to test correct data validation with Mocha using Loopback?

I'm setting up tests for already existing codeI want to test the creation of a database entry for an object, specifically how the create()-Method should behave when incorrect parameters are given

33
How to use axios to retrieve the redirected page content after sending a post to login

How to use axios to retrieve the redirected page content after sending a post to login

I am trying to scrap the page content after I send a post to log in

75
Formatting data after $facet aggregation in mongodb

Formatting data after $facet aggregation in mongodb

First of all, I've gone through several similar questions before posting this one and none have seemed to be accurate to my needs or I haven't been able to interpret them in a way that would work for me

60