using JSON.stringify(...) and JSON.parse(...)
see http://lists.jboss.org/pipermail/keycloak-user/2014-December/thread.html #1355
This commit is contained in:
parent
f620b04656
commit
ce1fd8eedc
2 changed files with 7 additions and 6 deletions
|
@ -619,7 +619,7 @@
|
|||
if (event.origin !== loginIframe.iframeOrigin) {
|
||||
return;
|
||||
}
|
||||
var data = event.data;
|
||||
var data = JSON.parse(event.data);
|
||||
var promise = loginIframe.callbackMap[data.callbackId];
|
||||
delete loginIframe.callbackMap[data.callbackId];
|
||||
|
||||
|
@ -652,7 +652,7 @@
|
|||
msg.callbackId = createCallbackId();
|
||||
loginIframe.callbackMap[msg.callbackId] = promise;
|
||||
var origin = loginIframe.iframeOrigin;
|
||||
loginIframe.iframe.contentWindow.postMessage(msg, origin);
|
||||
loginIframe.iframe.contentWindow.postMessage(JSON.stringify(msg), origin);
|
||||
} else {
|
||||
promise.setSuccess();
|
||||
}
|
||||
|
|
|
@ -17,14 +17,15 @@
|
|||
return;
|
||||
|
||||
}
|
||||
event.data.loggedIn = false;
|
||||
var data = JSON.parse(event.data);
|
||||
data.loggedIn = false;
|
||||
var cookie = getCookie('KEYCLOAK_SESSION');
|
||||
if (cookie) {
|
||||
event.data.loggedIn = true;
|
||||
event.data.session = cookie;
|
||||
data.loggedIn = true;
|
||||
data.session = cookie;
|
||||
}
|
||||
|
||||
event.source.postMessage(event.data,
|
||||
event.source.postMessage(JSON.stringify(data),
|
||||
event.origin);
|
||||
}
|
||||
window.addEventListener("message", receiveMessage, false);
|
||||
|
|
Loading…
Reference in a new issue