I have a server I'm trying to send cookies to. I send a first POST request, I store the received cookies from the response header and try with a second GET request to retrieve data an authenticated user could only access. The cross-domain request is okay, I'm able to retrieve my cookies within the Phonegap application, but when it comes to sending those, it fails. The request header does not contain any cookies. phonegap -v
returns 5.1.1-0.29.0
.
What I've already tried:
Add the domain to the whitelist
Make sure the cookies I saved were not in the request headers, server side, at all
Make the same request over C# to make sure it couldn't be a server side problem
The request code:
$.ajax(
{
type: "GET",
url: "url",
xhrFields: {
withCredentials: true
},
crossDomain: true,
beforeSend: function(xhr) {
xhr.setRequestHeader("Cookie", mycookies);
},
success: function(data){
console.log(data);
},
error: function (xhr) {
console.log(xhr.responseText);
}
}
);
Any help would be very appreciated, thank you.