How to keep multiple sets of cookies for XmlHttpRequest
===

I'd like to have multiple XmlHttpRequests use different sets of cookies, to keep multiple users logged in on the same site. What is the best way to achieve this?

Note that if required, I can use local storage to keep additional cookie sets between requests. But I still do not know how to use XmlHttpRequest with cookies different from the browser-wide cookies for the site.