I am trying to get token from drchrono.com. But I get following error. Can somebody please help me how to solve this?
Error
Access to XMLHttpRequest at 'https://drchrono.com/o/token/' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Method
function getToken() {
var authData = {};
authData.code = $("#txtCode").val();
authData.grant_type = "authorization_code";
authData.redirect_uri = "https://test.com/WebForm1.aspx";
authData.client_id = "asdfasdfadfassdfasddfdsaf";
authData.client_secret = "asdfasdfasdfasfasfasdfsafsadfsadf";
var jsonAuthData = window.JSON.stringify(authData);
var authDataUri = "https://drchrono.com/o/token/";
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: authDataUri,
data: jsonAuthData,
async: true,
crossDomain: true,
headers: {
'Access-Control-Allow-Origin': '*'
//'Access-Control-Allow-Origin': 'https://test.com/WebForm1.aspx'
},
beforeSend: function (XMLHttpRequest) {
},
success: function (data, textStatus, XmlHttpRequest) {
console.log(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
}
});
}