Http requests withCredentials what is this and why using it?
Short answer: withCredentials() makes your browser include cookies and authentication headers in your XHR request. If your service depends on any cookie (including session cookies), it will only work with this option set.
参考资料: