'Cookies sent from Angular client are null in Spring server

I am setting the cookie in with the command -

this.cookieService.set("SessionToken","Niket",20,"null",true,"Lax");

and passing in the interceptor-

authReq = req.clone({
  withCredentials:true,
  headers: new HttpHeaders({
    authToken: sessionStorage.getItem("authToken"),
    SessionToken: this.cookieService.get("SessionToken")
  }),
});

But still in the doFilterInternal HTTPServletRequest, I'm getting cookies as null. But I can see the cookies in Applications tab of Chrome. Please help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source