1
votes

I am calling sandbox API with post method also using authorization headers but it's showing following error. I have tried cross domain extension in Chrome that time it's working fine, but after disable its showing error.

Here is ajax the code.

$.ajax({
        url: 'https://'+BASE_URL+'/v3/company/'+companyid+'/account?minorversion='+minorversion,
        type: 'POST',
        crossDomain: true,
        dataType:'json',
        headers: {'Authorization': 'Bearer eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..ok78Pkecig1pIq_NoLipeA.2JHoUufZlQIJxlTE58Vqd0FP-PHl4XTfVCa_O9G66wylq6ATGc3jXp5gH9ecAbul_NbjFUQvBGp4Mu_6Zusovr7Uo70iaFr3zcwcv2bTRg7cdNV0e4ah-CFcYizPT2P4oGG4EUbO-om.30-lSg1HjG21HrckVEFBSg','Accept':'application/json','Content-Type':'application/json'},
        data: json,
        success: function(data) {
            console.log(data)
        }
    });

The following is the error showing in console area

Failed to load https://sandbox-quickbooks.api.intuit.com/v3/company/*************/account?minorversion=4: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://intuitdev.qwesys.com' is therefore not allowed access.

Please check this by change the browser like firefox or any other. Have you try this?Mr.Javed Multani
Yes but getting same error.Avinash Rathod
Does the documentation say the allow CORS requests?CBroe
Yes api perfectly working in postman but in ajax its showing errorAvinash Rathod