I am using a Web Service (Drupal 7 Services) for user login / logout through an Mobile App(not browser) using Ionic Framework. It requires that I set the the Header of POST method to the same cookie that was set on user login.
1) How to get the cookie header using AngularJS (version 1.3.5)
The cookie in Response Header on login is
...
Set-Cookie: SESSd6f3e35b53c92bc6e830d79db4d6eb6c=AEFJYKD8s6vAsizxgYaNOJPy0dPMQ1rJX8RYO-cjfXs;
...
2) How to put this in $http
headers using AngularJS
Next, how to set the Cookie for POST.
$http({
method : 'POST',
url : '192.168.1.10/app/user/logout',
dataType : 'json',
headers: {
'X-CSRF-Token': token,
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'Cookie': 'SESSd6f3e35b53c92bc6e830d79db4d6eb6c=AEFJYKD8s6vAsizxgYaNOJPy0dPMQ1rJX8RYO-cjfXs,
// HOW to set this cookie using angular to the value that was read on login
},
})