How to get origin !== null in iFrame

I am trying to follow the guide OAuth with Plugins | Plugin API but I got stuck on point 3.

  1. This plugin iframe redirects to a hostname under your control, for example a page hosted on your internet server. This will place the iframe on a non-null origin, which enables us to securely check its identity later in the flow.

After opening an iFrame for authorization the origin is still null.

        window.location.href = "https://myAuthProvider";
        console.log(window.origin); //null
      { height: 600, width: 400 }

Have you managed to solve this problem? I am also getting same error

Same problem:(