Reputation: 2460
I am using express and cookie-parser on my nodejs rest server. After the cookie was sent, I can see in the network: Set-Cookie:xxxx=xxxxxxxxxxx; Path=/; Expires=Tue, 29 Dec 2015 18:14:06 GMT; HttpOnly But there is nothing in my Browser cookie. Is it because I'm using localhost?
```
const app = express();
app.use(cookieParser());
app.post('/login', (req, res) => {
let email = req.body.email;
let pass = req.body.password;
(new User()).login(email, pass)
.then(response => {
if (response) {
res.cookie('mid', email, { expires: new Date(Date.now() + 900000), httpOnly: true })
.send('ok');
} else {
res.status(503).end();
}
});
});
```
Upvotes: 0
Views: 376
Reputation: 2460
I was using React + Relay and I need to add a
Relay.injectNetworkLayer(
new Relay.DefaultNetworkLayer('/graphql', {
credentials: 'same-origin',
})
);
To make it work.
Upvotes: 1