Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
Use window object to pull content of body from child window after 3rd party authentication

I have a web app running on localhost:3000 which contains a button. When the button is clicked, a new window (child) is opened with the following code:

        let handle = window.open(
          "abc.html",
          "extension_popup",
          "width=700,height=700,status=no,scrollbars=yes,resizable=no"
        );

Inside abc.html, I've got the following:

<!doctype html>
<html>
<title>3rd Party Login</title>
<head>
</head>
<body>
      <script crossorigin src="<3rd Party SDK>.min.js"></script>    
      <script type="text/javascript" src="./<3rd party wrapper>.js"></script>    
      <script type="text/javascript" src="./abc.js"></script>
</body>
</html>

abc.js has some code which triggers a login using the 3rd party SDK. The login uses Oauth 2.0 and therefore contains redirects. Once the login is successful, an authorization code is displayed on the child window. The URL on the child window now reads the 3rd party authentication server's address and not http://localhost:3000/abc.html.

My requirement is to pull this code displayed in the child window body after the login is complete from the parent page (http://localhost:3000).

I have 2 questions:

  1. Is it possible to achieve this? I've tried using the "handle" object to do something like the following: handle.document.getByElement("title") or handle.document.getByElement("body") I've not been able to pull any information. Instead I receive this error: Uncaught DOMException: Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.

  2. If this is possible, how can I wait for the authentication to complete on the parent page before querying for the information present in the body?

I've seen content-scripts as part of extensions that can be used to do a chrome.runtime.sendMessage() to pass information to another window. However, content-scripts only work within the scope of extensions. Right?

I also am not able to add any code in abc.js to pass this information back to the parent window because once the authentication process begins, the page gets redirected to the 3rd party domain.

I would really appreciate any suggestions on how to get this working.

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda