# Facebook and Google OAuth in new window?

**URL:** https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065
**Category:** Support
**Created:** [January 8, 2023, 6:21pm UTC](https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065 "2023-01-08T18:21:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![EGreg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/egreg/32/133614_2.png) [@EGreg](https://meta.discourse.org/u/EGreg)
#### Post date: [January 8, 2023, 6:21pm UTC](https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065/1 "2023-01-08T18:21:15Z")

</div>

We are hosting Discourse in an iframe, so google oAuth doesn’t really work because they have x-frame options to prevent loading it.

What we’d like to do is use window.open and have the “small” oauth url for fb and google open up, and then upon closing redirect window.opener properly. Is this possible with Discourse settings? Or where is the code to do the location redirect, so we could change it?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 8, 2023, 6:27pm UTC](https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065/2 "2023-01-08T18:27:03Z")

</div>

> [@EGreg](#):
>
> We are hosting Discourse in an iframe

I don’t believe this is officially supported. Discourse is a Single Page Application and there are no guarantees when it comes to running within an iframe.

See further:

> [@Running Discourse in an iframe](https://meta.discourse.org/t/running-discourse-in-an-iframe/54931/2):
>
> Discourse living in an iframe isn’t a common use. You can try, of course, but it’s not something we recommend.

---

<div class="post-metadata">

### Author: ![EGreg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/egreg/32/133614_2.png) [@EGreg](https://meta.discourse.org/u/EGreg)
#### Post date: [January 8, 2023, 6:41pm UTC](https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065/3 "2023-01-08T18:41:49Z")

</div>

I am not asking for guarantees. Just to know where the Javascript is that changes window.location so I can replace it with window.open

Discourse actually has a new config variable that allows it to be displayed in iframes, and it works. Look at [https://qbix.com/ecosystem](https://qbix.com/ecosystem) for instance, or [https://intercoin.app](https://intercoin.app)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 8, 2023, 6:49pm UTC](https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065/4 "2023-01-08T18:49:03Z")

</div>

> [@EGreg](#):
>
> Discourse actually has a new config variable that allows it to be displayed in iframes

Oh, that’s interesting, yes you are right, and it’s actually 3 years old 😅. It is hidden though which may indicate it has some limitations.

> <https://github.com/discourse/discourse/blob/055310cea496519a996b9c3bf4dc7e716cfe62ba/config/site_settings.yml#L1766>

---

<div class="post-metadata">

### Author: ![EGreg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/egreg/32/133614_2.png) [@EGreg](https://meta.discourse.org/u/EGreg)
#### Post date: [January 8, 2023, 8:06pm UTC](https://meta.discourse.org/t/facebook-and-google-oauth-in-new-window/251065/5 "2023-01-08T20:06:03Z")

</div>

Yup! So really my main question is — where is the code that is triggered when someone clicks Connect with Facebook or Google? How can I override it? Maybe in the site theme JS, so I don’t have to develop a plugin?

All I want to do is replace window.location.href = … with window.open()
