i tray to access to endpoint and get the token, but i have an error : Access to XMLHttpRequest at 'https://ptyi.test.com:8443/users/authenticate' from origin 'http:localhost:51780' has been blocked by CORS policy : Response to preflight request doesn't pass access control check: No 'Access Control-Allow-Origin; header is present on the requested resource. How can i solve it?, why via postman access ? thanks in advance !!
$.ajax({
type:"POST",
url: "https://ptyi.test.com:8443/users/authenticate",
data: { username :"test@sur.com" , password : "ff12dfb3L$"},
crossDomain: true,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert(result)
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status + " \n" + xhr.responseText, "\n" + thrownError);
},
});
});