2

I am building a website using Angular 5 as frontend, and JAX-RS with Jersey as backend. The website requires the user to login using their email and password, which is sent to the API with POST. I then want the client to receive a cookie, but this is where I'm having trouble. The API sends a response with a cookie (I can see the cookie when I test it in Postman), but in Google Chrome it looks like no cookie is received, and no header is named 'Set-Cookie'.

My method that sends the cookie from the backend:

@GET
@Path("cookie")
public Response getCookies(){
    NewCookie cookie1 = new NewCookie("cookie1", "test");
    return Response.ok().cookie(cookie1)
        .build();
}

I'm using a CORS-filter where I set AllowCredentials to true. What have I missed?

annaw
  • 31
  • 4
  • you can check that https://stackoverflow.com/questions/33629474/reading-and-inserting-chrome-cookies-java – mooga Jun 19 '18 at 10:27
  • Thanks @mooga , but does this mean that I have to do this for every single browser? I thought that the cookie would set automatically in the client (no matter which browser) – annaw Jun 21 '18 at 09:12

0 Answers0