Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

CORS - Uncaught TypeError: Cannot read properties of null (reading 'postMessage') #470

Open
floxrot opened this issue Feb 18, 2022 · 3 comments

Comments

@floxrot
Copy link

floxrot commented Feb 18, 2022

Hi i have an error on a new project.
The Popup Window /auth-callback/ can't send a message to the main window because the orgin call for the Window comes not from the main Window /admin/ but from https://login.microsoftonline.com/common/oauth2/. Because of the CORS the window.opener is null and throw this error in hte /auth-callback/ console.

Have anybody a workaround? Or will i configure the Webserver to allow Cross Orgin and have a potentiel security risk?

@lisabutti
Copy link

I struggle with the same issue. So would also be interested in a solution.

@binste
Copy link

binste commented May 6, 2022

Had the same issue and for me it was caused by the new setting SECURE_CROSS_ORIGIN_OPENER_POLICY in Django 4. If you set it to None, the popup window again has a reference to the main window and it worked. However, I'd prefer to not disable this security feature. Maybe the Redirect based authentication flow could be used?

@lisabutti
Copy link

This fixed my issue, thanks!

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

No branches or pull requests

3 participants