Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

329
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!