Hi I'm in the process of authenticating a user via OAuth 2.0 and I'm getting a Access-Control-Allow-Origin error (XMLHttpRequest cannot load https://www.box.com/api/oauth2/token. Origin http://localhost is not allowed by Access-Control-Allow-Origin.
) when making the following POST request:
var xhr=new XMLHttpRequest();
xhr.open('POST',path,true);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.onload = function() {
var text = xhr.responseText;
alert('Response from request to ' + path + ': ' + text);
};
xhr.onerror = function() {
alert('Woops, there was an error making the request.');
};
xhr.send(params);
Any help would be greatly appreciated! I've looked into CORS, JSONP, and adding callback=? to the url but nothing I've tried is working.