Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda