I have a login service that performs an http request (to a php backend server) and returns a cookie. After login this cookie is needs to be used in all further requests done
Try this for the login:
(...)
return this.http.post("http://localhost/request.php", "data="+ jsonRequest,
{ withCredentials: true,
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded'
})
}).map(...)
And the other requests:
(...)
return this.http.post("http://localhost/request.php", "data="+ jsonRequest,
{withCredentials: true}).map(...)
Basically, just use withCredentials
option set to true
.