Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-Origin-Opener-Policy policy would block the window.closed call. #326

Open
Lenur29 opened this issue Jan 16, 2024 · 4 comments
Open

Comments

@Lenur29
Copy link

Lenur29 commented Jan 16, 2024

Hello @MomenSherif and everybody.

Please help me if you can. When I try to register with my google account and open the registration popup I see this error in the console
"Cross-Origin-Opener-Policy policy would block the window.closed call." Dispite of this error it works, but I do not like that it is present in the console. I read about Content Security Policy(MomenSherif attached the link [https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid#content_security_policy], but to be honest I do not understand what exactly I need to add to make it work without errors. Has anybody implemented something to solve this error? The same error you can see on this demo [https://react-oauth.vercel.app/] when you try "Authorization"

@devmahmud
Copy link

Have you found any solution @Lenur29?

@Lenur29
Copy link
Author

Lenur29 commented Jan 19, 2024

@devmahmud unfortunately no( And you? I hope @MomenSherif will help us...

@Super515
Copy link

First, create "CRACO.CONFIG.JS" file
//craco.config.js
module.exports = { devServer: { headers: {'Cross-Origin-Embedder-Policy': 'require-corp', 'Cross-Origin-Opener-Policy': 'same-origin', }, }, };

Second, install node module.
npm install @craco/craco

Third, change "package .json" file

"scripts": { "start": "craco start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }

I hope it would be helpful for you.

@nicmart-dev
Copy link

nicmart-dev commented Jun 4, 2024

I was able to make the error go away by passing prop use_fedcm_for_prompt mentioned in https://www.npmjs.com/package/@react-oauth/google?activeTab=readme

What hinted me to do that is the mention below in https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid#content_security_policy

When FedCM is enabled the browser directly renders popups and no changes are necessary.

EDIT: still troubleshooting though as it then does not log in as login pop up closes after reading "One moment please".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants