CORS error while integrating the Azure AD with jQuery

New Contributor

We are using simple jQuery to get the access token from Azure AD. But we are facing the CORS error we are not understanding what we are doing wrong.


Here is the code:

type: "POST",
URL: "",
headers: {
"Content-Type": "application/x-www-form-URL encoded; charset=utf-8",
"Access-Control-Allow-Origin": "*"
crossDomain: true,
data: {
"client_id": "xxxx-xxxx-xxxx-xxxx",
"resource": "",
"client_secret": "client secret",
"grant-type": "client credentials"
success: function (data, textStatus, xhr) {
var results = data;
error: function (jqXHR, exception) {
var msg = jqXHR.status;


0 Replies