I am programming an application that uses ReactJs for the front-end in localhost:3001 and Symfony for the back-end localhost:3000, and to enable cross origin communication I use "cors-bundle" in Symfony. Now I want to create a Cookie when a user log in, but it doesn't seem to be created !
Thanks for your help,
This is the code in Symfony the moment a user logs in :
use Symfony\Component\HttpFoundation\Cookie;
$cookie = new Cookie( 'my_cookie', 1, strtotime('tomorrow') );
$res = new Response();
$res->headers->setCookie( $cookie );
return new JsonResponse($res);
This what I also tried :
$res->headers->setCookie(Cookie::create('my_cookie', 1));
return new JsonResponse($res);