# The target origin provided does not match the recipient window's origin (Iframe integration)

**URL:** <https://forums.rocket.chat/t/the-target-origin-provided-does-not-match-the-recipient-windows-origin-iframe-integration/1387>\
**Category:** Community Support\
**Created:** [June 22, 2018, 4:30pm UTC](https://forums.rocket.chat/t/the-target-origin-provided-does-not-match-the-recipient-windows-origin-iframe-integration/1387 "2018-06-22T16:30:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![philmcp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/philmcp/32/352_2.png) [@philmcp](https://forums.rocket.chat/u/philmcp)\
**Post date:** [June 22, 2018, 4:30pm UTC](https://forums.rocket.chat/t/the-target-origin-provided-does-not-match-the-recipient-windows-origin-iframe-integration/1387/1 "2018-06-22T16:30:47Z")

</div>

Hi all, having some issues setting up iframe integration ☹

My Rocketchat is hosted at [https://chat.mydomain.com](https://chat.mydomain.com)

My web app (where the iframe is) is hosted at [https://app.mydomain.com](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.

---

<div class="post-metadata">

**Author:** ![MindtoEye](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/mindtoeye/32/440_2.png) [@MindtoEye](https://forums.rocket.chat/u/MindtoEye)\
**Post date:** [July 20, 2018, 12:23pm UTC](https://forums.rocket.chat/t/the-target-origin-provided-does-not-match-the-recipient-windows-origin-iframe-integration/1387/2 "2018-07-20T12:23:56Z")

</div>

To see if this works at all, see what happens if you change ‘[https://chat.mydomain.com](https://chat.mydomain.com)’ with ‘\*’ If that works then you have a cross domain issue. Remember that the domain you specify has to perfectly and exactly match.

---

<div class="post-metadata">

**Author:** ![nhannv](https://avatars.discourse-cdn.com/v4/letter/n/f0a364/32.png) [@nhannv](https://forums.rocket.chat/u/nhannv)\
**Post date:** [August 17, 2018, 4:08am UTC](https://forums.rocket.chat/t/the-target-origin-provided-does-not-match-the-recipient-windows-origin-iframe-integration/1387/3 "2018-08-17T04:08:44Z")

</div>

Hi, if change it to ‘\*’. i resent, i see no request sent from my browser.

---

<div class="post-metadata">

**Author:** ![ptkferraro](https://avatars.discourse-cdn.com/v4/letter/p/e495f1/32.png) [@ptkferraro](https://forums.rocket.chat/u/ptkferraro)\
**Post date:** [February 14, 2019, 10:23am UTC](https://forums.rocket.chat/t/the-target-origin-provided-does-not-match-the-recipient-windows-origin-iframe-integration/1387/4 "2019-02-14T10:23:13Z")

</div>

Hi Phil. I am facing the same problema with my react app. Did you get it working?
