window.opener = null on browser mobile (ex: google chrome apps)

453 views Asked by At

I'm having pop up authentication (instagram & twitter), the flow is:

  1. in page /home user click button instagram auth
  2. onClick --> window.open(INSTAGRAM_AUTH_URL, '_blank', null)
  3. pop up window will authenticate instagram then redirect to page /social-auth
  4. in /social-auth I did:

     if (window.opener) {
       window.opener.postMessage(data)
       window.close()
     }
    
  5. in page /home I have listener window.addEventListener('message', .....) to receive the postMessage data from /social-auth

The problem is, on step 4 the window.opener = null on mobile browser (I tried on chrome apps).


Is there anything that I'm missing? FYI it's working fine on desktop browser and I'm using React.js for the framework

0

There are 0 answers