Gustavo Contreiras
Gustavo Contreiras

Reputation: 580

Browser not saving response cookies

Frond-end: React (react-admin) with Webpack
Back-end: NestJS / Express

I developed 3 routes (login, check and logout) that are beautifully working with Swagger UI, but when I try to use the 'login' route in my login page it doesn't save the cookie in the browser > application > storage > cookies

I'm setting the cookie on the back end with this code:

response.cookie('tk', 'Bearer ' + token, {
    domain: hostname, // localhost or 127.0.0.1
    path: "/",
    expires: oneMonthFromNowDate,
    httpOnly: true,
    secure: false,
    sameSite: true
});

And in the front end I'm receiving a successfull response with the cookie assigned:

enter image description here

enter image description here

But it is not saving in the browser > application > storage > cookies!

enter image description here

Upvotes: 0

Views: 727

Answers (1)

Gustavo Contreiras
Gustavo Contreiras

Reputation: 580

Looks like I was missing some kind of configuration...

Solved using Axios with "credentials: true" option.

Upvotes: 1

Related Questions