# Winchan.js:150 Cross-Origin-Opener-Policy policy would block the window.closed call

**URL:** <https://community.auth0.com/t/winchan-js-150-cross-origin-opener-policy-policy-would-block-the-window-closed-call/110030>\
**Category:** Get Help\
**Tags:** application, sso\
**Created:** [June 27, 2023, 4:03am UTC](https://community.auth0.com/t/winchan-js-150-cross-origin-opener-policy-policy-would-block-the-window-closed-call/110030 "2023-06-27T04:03:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chithra.sahadev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chithra.sahadev/32/48348_2.png) [@chithra.sahadev](https://community.auth0.com/u/chithra.sahadev)\
**Post date:** [June 27, 2023, 4:03am UTC](https://community.auth0.com/t/winchan-js-150-cross-origin-opener-policy-policy-would-block-the-window-closed-call/110030/1 "2023-06-27T04:03:42Z")

</div>

Hi All, I am creating OwnUI with Auth0.js and getting below error on webAuth.popup.authorize(  
winchan.js:150 Cross-Origin-Opener-Policy policy would block the window.closed call.  
winchan.js:195 Cross-Origin-Opener-Policy policy would block the window.postMessage call.

Please help on this issue

webAuth.popup.authorize({  
responseType: ‘token’,  
connection: ‘google-oauth2’,  
redirect\_uri: ‘[https://localhost:44335/createaccount.aspx](https://localhost:44335/createaccount.aspx)’,  
prompt: ‘login’,  
owp: true,  
scope: “profile email openid”,  
}, (err, authResult) =\> {

```
                if (err != null) {

                    console.log(err);
                    return false;

                }

                webAuth.client.userInfo(authResult.accessToken, function (err, user) {

                    if (err != null) {
                        return false;
                    }
                    if (user != null) {

                        //doing something

                    }
                });
               
            });

```

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [January 28, 2025, 8:11pm UTC](https://community.auth0.com/t/winchan-js-150-cross-origin-opener-policy-policy-would-block-the-window-closed-call/110030/3 "2025-01-28T20:11:03Z")

</div>

Hi @chithra.sahadev

Welcome to the Auth0 Community!

I am sorry regarding the late reply to your inquiry.  
If you still have issues with this problem, do not hesitate to leave a reply or post again on the community page.

As far as I have researched the error that you are receiving, it appears to be an error thrown by the `firebaseui` npm package. Currently, there does not appear to be a definitive fix to the issue at hand, however I was able to identify some possible workarounds or causes which trigger the respective error:

- The easiest way to check that your code is working without the error is to switch temporarily from `signInFlow="popup"` to `signInFlow="redirect"` , which is the [default value](https://github.com/firebase/firebaseui-web#configuration) in Firebase UI Auth.
- Since you are experiencing issues with google authentication in your implementation, you can attempt using _ **same-origin-allow-popups** _ header instead of _same origin_ for Cross-Origin-Opener-Policy on pages where you use google sign in button.
- If you are using any kind of API in your implementation, please double check the scopes since that might trigger the error.
- If you are using NextJS, you can attempt to add the following code inside the `next.config.js`:

```auto
async headers() { return [{ source: '/(.*)', headers: [ { key: 'Cross-Origin-Opener-Policy', value: 'same-origin', },], }, ]; },

```

If you do not have such a file, add it in the root directory.

- If your code uses `signInFlow: 'popup'`, attempt to remove it from the code.
- Attempt adding the following meta tags in the head of your html:

```auto
<meta Content-Security-Policy-Report-Only: script-src
https://accounts.google.com/gsi/client; frame-src
https://accounts.google.com/gsi/; connect-src
https://accounts.google.com/gsi/; />

```

- You can attempt to provide a prompt when signing in with google as follows:

```auto
const signInWithGoogle = async () => {
const provider = new GoogleAuthProvider(); // 
provider.setCustomParameters({ prompt: 'select_account' });
try {
await signInWithPopup(auth, provider); // 
} catch (error) {
alert(error.message);
}
};

```

- You can attempt to remove the COOP/COEP headers that you have added in your application as per this [github](https://github.com/vercel/next.js/discussions/51135#discussioncomment-10627949) post related to the same issue that you are experiencing.

In conclusion, the COOP errors appears to be triggered by the browser’s policies, the error may vary from browser to browser and a definitive fix may vary depending on your application/implementation.

If you have any additional questions regarding the matter, feel free to leave a reply or post again on the community page!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 11, 2025, 8:12pm UTC](https://community.auth0.com/t/winchan-js-150-cross-origin-opener-policy-policy-would-block-the-window-closed-call/110030/4 "2025-02-11T20:12:04Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
