I once encounter an issue on my oauth login flow with window.open/window.opener bug on ms-edge
My flow before this issue was
- On login button click open a popup
- After successful login the oauth app redirect to my domain's page
- Then i call a function of the parent window from with in the popup (window.opener.fn) with data from oauth response and the parent window then close the child popup window
My flow after this issue was
- On login button click open a popup
- Create a setinterval in case (window.opener is undefined)
- After successful login the oauth app redirect to my domain's page
- Check if window.opener is available then do #3 from the above flow and clearInterval
- If window.opener is not available then since i am on my domains page i try to set localstorage and try to read the localstorage from inside the setInterval function in parent window then clear the localstorage and setInterval and proceed.
- (for backward compatibility) If localstorage is also not available then set a client side cookie with the data with a short expiry (5-10 sec) time and try to read the cookie (document.cookie) inside the setInterval function in parent window and proceed.