F
F
FNY3PM2021-03-31 21:42:01
Angular
FNY3PM, 2021-03-31 21:42:01

How to set cookies in Angular?

There is a front on https://localhost:4200 , there is an API on the cloud server, also on https. When I send a request from localhost no header cookie is set. Returns a set-cookie header with a cookie whose parameters are: HttpOnly, Secure, SameSite=None, Path=/. But the cookie is not written to localhost, and if you upload the build to the server and send a request from the same domain, then everything works.

I use the following code when requesting:

this._httpClient.post(`${environment.apiUrl}/${this.postfix}/login`, loginData, {withCredentials: true})

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question