Thread:Talk:Requests for comment/API Future/CORS and third-party web apps

Currently, web applications using client-side JavaScript can only access our API via JSONP (wrapped in a function call and run through a tag). This is a bit nasty for several reasons:
 * different URLs -> breaks potential shared caching with other apps that use the same queries over JSON
 * harder to get progress feedback or detect errors
 * can't do POST requests at all
 * authentication is disabled to prevent CSRF stealing a web user's credentials

This has practical limitations for some mobile platforms as well -- for instance our Wikipedia app for Firefox OS is a web app hosted on bits.wikimedia.org. Since an XHR can't access *.wikipedia.org/w/api.php from there, it has to use either JSONP or a server-side proxy (icky, hides IPs, no load balancing, etc). Since a proxy is icky and hard to scale, we're using JSONP for now... but this won't work once we try to add login and editing features, since auth isn't available.

If we had CORS headers set up to allow non-authenticated (no cookies) access via XHR from all third-party domains, and we could auth without cookies (can we use a token for this? I .... think so) that would be helpful.

Not sure if that's doable on the current API or not. :D