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

319
Visualizações
Gmail API : Extract "code" param from the URL of a pop-up window to get the access_token details

Iam trying to authenticate gmail using OAuth2 for my web application. From the server, we return a url to the client, which then uses that to open a pop-up. The code is as shown:

        var win = window.open(data.google_oauth_url, `<h1>Gmail</h1>`, 'width=800, height=600');
          var pollTimer = setInterval(() => { 
              try {
                  const searchParams = new URL(win.document.URL).searchParams
                  console.log("url is",win.document.URL, searchParams, searchParams.get("code"))
                  if (searchParams.get("code") != -1) {
                      clearInterval(pollTimer);
                      win.close();
                  }
              } catch(e) {
                console.log("Error",e)
              }
          }, 500);

From the pop-up , i want to extract the "code" param which google returns to us after the authentication is completed. But when i try to extract the param from the client side, iam facing an error :

Uncaught DOMException: Blocked a frame with origin "https://xyz" from accessing a cross-origin frame

Is anyone aware of a solution for this, or any other ways of extracting the "code" param so i can proceed to get the access_token details. Thanks in advance.

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