J
J
jedifa2021-09-09 22:01:40
Node.js
jedifa, 2021-09-09 22:01:40

Why are cookies not saved on the client after deployment?

Please tell me, there is authorization on the site, after a successful login, cookies with a token are saved on the client, everything worked on the localhost, the cookies were saved, but after the deployment, the authorization is successful, but the cookies are not saved on the client.

import * as cookieParser from "cookie-parser";
app.use(cookieParser());
  app.enableCors({ origin: "url сайта", credentials: true });

There is a cookie parser, everything is fine with the cors.
response.cookie("token", token, { httpOnly: true });

this way I save cookies on the client.
Cookies are not saved only after deployment, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-09-09
@karabanov

The domain is probably not the same. Look in the HTTP headers for specific cookies.
Still there is a variant that lifetime is incorrectly specified.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question