How to send http only cookies with every request in decoupled frontend and backend? My frontend and backend are deployed through heroku , frontend is here :- https://chatapp-client-12345.herokuapp.com/
backend is here :- https://chatappbackend12345.herokuapp.com/
I want to send my http only cookie(containing jwt) to my backend with every request that I set with my backend like this :-
// generate jwt
let jwtToken = jwt.sign({
email:email,
userId:userData._id
},"somesupersecret");
res.cookie("jwtToken",jwtToken,{
expires:new Date(Date.now() + 3600000),
httpOnly:true,
domain:"chatapp-client-12345.herokuapp.com"
});
but the http only cookie is not set in the frontend
Through my research I came to know that I can only access cookie on same domain , but what should I do if my frontend and backend are decoupled?
my backend is based on node js built with rest apis and frontend containing simple html css js served with node js