On localhost:3000 I'm hosting a Node/Express app that saves users in Mongo. On localhost:8080 I'm trying to host an AngularJS frontend SPA for it. I've implemented JWT authentication for securing my backend API endpoints but I don't want to send the token in the Authorization header as that doesn't offer me persistent login.
By Googling I've learned that the best place to store a JWT is an HttpOnly cookie. This works fine for Postman but Chrome won't set the cookie on localhost:8080, as I believe different ports count as different domains, and so Chrome won't do what I want because it would be a security flaw.
What's my best course of action here? I feel pretty stuck. Is there a way to implement secure JWT authentication for a decoupled frontend and backend app and still offer persistent login? Even if I drop the JWT I still won't be able to set cookies across different domains, no?