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

326
Vistas
Google Auth don't work in mobile popup_closed_by_user error

I created an web application (js) that connects with Google. It works on PC but not on mobile. The error indicated is popup_closed_by_user while I did not close the popup!! I would like some help please, here is an example:

    <!DOCTYPE html>   
        <html lang="en">
        <head> 
          <script src="https://apis.google.com/js/api:client.js"></script>
            <title>Document</title>
        </head>
        <body>
<h3>warning: there is Script Error bc client id is not entered. this example don't work in stackoverflow code snippet</h3>
            <h1>name: <span id="namegoogle">not connected</span></h1>
            <h1>image: <img id="img_google" alt="not connected"/></h1>
            <button id="customBtn">GOOGLE: click to connect</button>
            <p>ERROR: <span id="errorgoogle">[NO ERROR]</span></p><br><br><h3>WARNING: CLIENT ID IS NOT DECLARED</h3>
        </body>
        <script>var is_google_user_succed_942894 = false;
    var google_getGivenName = "";var google_getFamilyName = "";var google_getAvatarUrl = "";
    var googleUser = {};var startApp = function() {
            gapi.load('auth2', function(){
              // Retrieve the singleton for the GoogleAuth library and set up the client.
              auth2 = gapi.auth2.init({
                client_id: '################################################################################################.apps.googleusercontent.com',
                cookiepolicy: 'single_host_origin',
                // Request scopes in addition to 'profile' and 'email'
                //scope: 'additional_scope'
              });
              attachSignin(document.getElementById('customBtn'));
            });
          };
    startApp();
          function attachSignin(element) {
            console.log(element.id);
            auth2.attachClickHandler(element, {},
                function(googleUser) {
    document.getElementById("namegoogle").innerHTML = googleUser.getBasicProfile().getName();
        document.getElementById("img_google").src = googleUser.getBasicProfile().getImageUrl();
              }, function(error) {
                  var error_msg = error['error']; document.getElementById('errorgoogle').innerHTML = error_msg;
                });
    }
        </script><script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
        </html>

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