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

367
Visualizações
How can I redirect the parent page after OAuth 2 flow is complete?

My current flow is such:

  1. User clicks login to third party
  2. Upon grant, the third party redirects to configured redirect uri with code
  3. Forward code to backend to verify, etc.
  4. Return success/failure

My frontend is coded to close the popup when the login is successful, but the parent page still just remains the same - standard login page. The goal would be to redirect that page.

I've tried to add an event listener on the window object, but it's not working.

...
  const loginWindow = window.open(oAuthUrl,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height=450')
  loginWindow.onbeforeunload = function () {
    alert("new window closed");
  }
};

Is this possible?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Ok, I have something that seems to be working:

        fetch('http://localhost:8080/user/login', requestOptions)
            .then(response => response.json())
            .then(data => window.close())
            .then(data => window.opener.location.replace("/"))
    }

window.opener allows you to access the parent window.

about 4 years ago · Juan Pablo Isaza Relatório
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