Unable to log in due to session cookies not being passed in I have an html5 app which logs the user into drupal via services 3.11 but I am unable to connect.

Using the Chrome Postman plugin I can connect as expected.
The difference between Postman and my code is that the cookie session is not being passed from my app.
From what I have read the withCredential: true is supposed to pass the session cookie but it's not working for me?


api/user/login.json - Logs the user in as expected
api/user/token.json - returns the token as expected
api/system/connect.json - Always returns the data for Anonymous user 0


The system/connect code sent after login and token is:

                jQuery.ajax({
                    type: "POST",
                    url: connectUrl,
                    xhrFields: {
                        withCredentials: true
                    },
                    success: function (result) {
                        dosomething();
                    },
                    error: function (result) {
                        dosomething();
                    },
                    beforeSend: function (xhr) {
                        xhr.setRequestHeader('X-CSRF-Token', Session.user_token);
                    },
                });
For anyone else who stumbles across this problem I did finally manage to solve it with the following which ensures the credentials are pass for each call consistently. I'm assuming where CORS adds in the additional OPTIONS request, the credentials we're going through.

jQuery.support.cors = true;
    jQuery.ajaxSetup({
        xhrFields: {
            withCredentials: true   // Pass session cookie with requests
        }
    });