The issue occurs in the default HTTP request getJSON method and the issue is that the status we receive is a 200 but the response is undefined. This happens even if we set the responseType to "text".
This problem can be solved by doing a few things:
Using the XDomainRequest (which should only be defined in IE9 based on the research we did)
Parsing the responseText into a json object if the response is undefined
Using this pull request (https://github.com/IdentityModel/oidc-client/pull/7) to allow injection of custom headers. In IE9 we had to set the responseType to "text". This change in oidc-client is very helpful since oidc-client is used by token-manager to handle all the calls to the id server in the metadata retrieval
This pull request (https://github.com/IdentityModel/oidc-client/pull/6) may be able to be used to get around it as well, however due to how the dist/oidc-token-manager.js is packaged, there are actually two implementations for DefaultHttpRequest, one which is from the lib in the oidc-token-manager repo, and another which is packaged with the dist/oidc-client. That in itself might be an issue.
var xhr = new XMLHttpRequest();
if (typeof XDomainRequest !== "undefined") {
xhr = new XDomainRequest();
xhr.onprogress = function() {};
}
xhr.open("GET", url);
xhr.responseType = "json";
if (config) {
if (config.headers) {
setHeaders(xhr, config.headers);
}
}
xhr.onload = function () {
try {
//XDomainRequest does not have status property
if (typeof xhr.status === "undefined" || xhr.status === 200) {
var response = xhr.response;
if (typeof response === "string") {
response = JSON.parse(response);
}
//IE8-9 doesn't support native json
if (typeof response === "undefined") {
response = JSON.parse(xhr.responseText);
}
resolve(response);
}
else {
reject(Error(xhr.statusText + "(" + xhr.status + ")"));
}
}
catch (err) {
reject(err);
}
};
xhr.onerror = function () {
reject(Error("Network error"));
};
xhr.send();
I've been following this issue in oidc-client (https://github.com/IdentityModel/oidc-client/issues/5) for using the oidc-client in IE9. My team has been experiencing the same issue with the token manager.
The issue occurs in the default HTTP request getJSON method and the issue is that the status we receive is a 200 but the response is undefined. This happens even if we set the responseType to "text".
This problem can be solved by doing a few things: