llo i am using box api to for integration they have given just curl to get access token which is as follow
is curl https://www.box.com/api/oauth2/token \
-d 'grant_type=authorization_code&code={your_code}&client_id={your_client_id}&client_secret={your_client_secret}' \
-X POST
I want to get access token using jquery ajax request i have tired my code like this as follow :
var data2= '{"grant_type":"authorization_code", "client_id":"61oliuyi1jckqos0j8zzl9h4t791umux" ,"client_secret":"Oi1XS56al61oOrrvAL3i5gdPTfe7QO9V" ,"code" :"'+code+'"}';
var data1 = JSON.parse(data2);
$.ajax({
type: 'POST',
url: "https://www.box.com/api/oauth2/token",
data: data1,
success: function(json) {
console.log(e);
alert("success"+json);
},
error: function(e) {
console.log(e)
alert("Failure"+ JSON.stringify(e));
}
});
MLHttpRequest cannot load https://www.box.com/api/oauth2/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.