I have a web application where the front end comprises of Angular application running on a domain say: http://localhost:4200 and the backend comprises of the NodeJs application running on a different domain say: http://localhost:3000.
Now I set a cookie from the backend whenever a user logs in successfully and that cookie contains a token. In http://localhost:4200(frontend) when the user logs in, the cookie appears only in the Network tab against the '/user/login' api request as shown in below image. But I don't see this cookie in the Applications tab even when I open a different browser tab and hit, http://localhost:3000(backend). I don't know the reason for this.
Next I want to ask how to set a cookie from http://localhost:3000(backend) such that when I send requests from http://localhost:4200(frontend) the cookie should also be sent with the request?
And is it possible to achieve this without sending the token in the response body instead of the cookie and then storing it in browser local storage at the frontend and using http interceptors in angular to add the token maybe in the headers for each request to protected routes?