This question is locked. New answers and comments are not allowed.
Hi,
I am posting this as a general question and in the hope it may clear up the problems using CORS and help others with similar issues.
I have been working on an app which primarily uses the REST API for CRUD operations but also with a few Javascript SDK methods for ease.
May be worth noting that the JS SDK is basically the REST API under the hood.
I will use my login as an example for this question as it is the first place my app fails in IE8/9, it was also using the JS SDK method but IE8/9 will not even entertain the request and just throws the good old 'Access Denied' error.
So, since CORS is just an Ajax call I have change my login to using the REST method so that I can really try to troubleshoot things.
I am also using a Jquery helper plugin for CORS, this also has a test which works fine in IE8/9. The difference is that this is only using a simple header (contentType: "text/plain; charset=utf-8"), and the Backend requires a complex header (contentType: "application/json; charset=utf-8") as this is the type of data it needs to parse. This complex header requires a Preflight check (handshake) with the remote server which sends a response back before the actual request is sent and processed.
Everything works great in Chrome/Safari/Firefox & IE10+, the Preflight comes back fine (OPTIONS Ok) and the request is also fine. If you look at the attached screenshots you can see the response in Chrome and the other in IE9. You will see that Cross Origin is fine in both browser dev tools only IE9 has a bad request (400).
The only difference is I cannot see the Preflight check happen in IE dev tools, I only see the actual request response. I am presuming that the check response is good in IE or I would not get a response at all (as per the attached screenshot).
Here is my Ajax login authentication
So why is IE9 showing the response as a bad request?
My concerns are that this is only the 'Read' part of many CRUD operations going on in the app.
Any help would be greatly appreciated.
Thanks,
Daniel
I am posting this as a general question and in the hope it may clear up the problems using CORS and help others with similar issues.
I have been working on an app which primarily uses the REST API for CRUD operations but also with a few Javascript SDK methods for ease.
May be worth noting that the JS SDK is basically the REST API under the hood.
I will use my login as an example for this question as it is the first place my app fails in IE8/9, it was also using the JS SDK method but IE8/9 will not even entertain the request and just throws the good old 'Access Denied' error.
So, since CORS is just an Ajax call I have change my login to using the REST method so that I can really try to troubleshoot things.
I am also using a Jquery helper plugin for CORS, this also has a test which works fine in IE8/9. The difference is that this is only using a simple header (contentType: "text/plain; charset=utf-8"), and the Backend requires a complex header (contentType: "application/json; charset=utf-8") as this is the type of data it needs to parse. This complex header requires a Preflight check (handshake) with the remote server which sends a response back before the actual request is sent and processed.
Everything works great in Chrome/Safari/Firefox & IE10+, the Preflight comes back fine (OPTIONS Ok) and the request is also fine. If you look at the attached screenshots you can see the response in Chrome and the other in IE9. You will see that Cross Origin is fine in both browser dev tools only IE9 has a bad request (400).
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://nb-dev.worldsecuresystems.com
The only difference is I cannot see the Preflight check happen in IE dev tools, I only see the actual request response. I am presuming that the check response is good in IE or I would not get a response at all (as per the attached screenshot).
Here is my Ajax login authentication
var user = {
"username": $scope.details.username,
"password": $scope.details.password,
"grant_type": "password"
};
$.ajax({
url: 'https://api.everlive.com/v1/*api-key*/oauth/token',
data: JSON.stringify(user),
contentType: "application/json; charset=utf-8",
type: 'POST',
dataType: 'json',
success: function(data) {
alert(JSON.stringify(data));
},
error: function(jqXHR, textStatus) {
alert(textStatus);
}
});
So why is IE9 showing the response as a bad request?
My concerns are that this is only the 'Read' part of many CRUD operations going on in the app.
Any help would be greatly appreciated.
Thanks,
Daniel