Hi all, having some issues setting up iframe integration
My Rocketchat is hosted at https://chat.mydomain.com
My web app (where the iframe is) is hosted at https://app.mydomain.com
I’ve been able to register the user fine on the back, returning an authToken when they login. When I try the to post the authLogin back to the iframe from within my ReactJS application…
<iframe src="https://chat.scoopmarkets.com/?layout=embedded" onLoad={() => this.login()} />
...
onLoad(){
window.parent.postMessage({
event: 'login-with-token',
loginToken: authToken
}, 'https://chat.mydomain.com');
}
… I get the following error however:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://chat.mydomain.com') does not match the recipient window's origin ('https://app.mydomain.com').
Any ideas?
p.s. Ive enabled iframe integration in the settings as well as enabled CORS.