KEYCLOAK-4037 JS Adapter fails in Cordova mode for iOS apps

This commit is contained in:
Marko Strukelj committed 2017-05-03 17:05:54 +02:00
1 parent 16aaa3bf01
commit 47ea1ade8a
1 file changed
+5 -1
@@ -587,7 +587,7 @@
req.onreadystatechange = function () {
if (req.readyState == 4) {
if (req.status == 200) {
if (req.status == 200 || fileLoaded(req)) {
var config = JSON.parse(req.responseText);
kc.authServerUrl = config['auth-server-url'];
@@ -633,6 +633,10 @@
return promise.promise;
}
function fileLoaded(xhr) {
return xhr.status == 0 && xhr.responseText && xhr.responseURL.startsWith('file:');
}
function setToken(token, refreshToken, idToken, timeLocal) {
if (kc.tokenTimeoutHandle) {
clearTimeout(kc.tokenTimeoutHandle);