I think this could be happening due to your server having a different domain and your localhost on a different domain. This is mainly because your server is being treated as a third party and that wont be allowed to set cookie on your frontend.