Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Google Sign-In now returning error popup_closed_by_user #506

Closed

Description

@sachinrekhi

Our Electron desktop application has been using Google Sign-In for months now without any issues. But all of a sudden, starting today, Google Sign-In from our Electron desktop app started returning the "popup_closed_by_user" error. The login pop-up properly renders and you can successfully login to your Google account, but when the pop-up closes, instead of it properly logging in the user, it returns the popup_closed_by_user error.

Google Sign-In continues to work fine for our website from web browsers like Chrome, Safari, and Firefox, but no longer works from our Electron desktop app.

It appears there has been some kind of regression in the Google Sign-In service?

Our google auth code for reference:

var googleAuth

gapi.load('auth2', function() {
    googleAuth = gapi.auth2.init({
        client_id: 'XXX',
        scope: 'email profile',
        fetch_basic_profile: false
    })
})

function beginGoogleAuth() {
    googleAuth.grantOfflineAccess({
        prompt: 'select_account',
        redirect_uri: 'postmessage'
    }).then(function(response) {
        document.getElementById('login-google-auth-code').value = response.code
        document.getElementById('login-form').submit()
    })
}

Activity

  1. aabuhijleh commented on Feb 11, 2019

    @aabuhijleh

    I'm encountering the exact same issue with Electron. Working fine on Chrome.

  2. sachinrekhi commented on Feb 11, 2019

    @sachinrekhi
    Author

    @grant looks like there was a regression in Google Sign-in recently. Seems somewhat similar to #473 in that it is only affecting certain clients like Electron, though the error in this case is different. Any chance you could ping the team to see if anything changed?

  3. diabolic8733 commented on Feb 11, 2019

    @diabolic8733

    Same exact issue with Electron starting on Feb 6th. No changes were made to our end.

  4. grant commented on Feb 11, 2019

    @grant
    Contributor

    I do not seem to see recent changes to the gapi client.
    Perhaps this is related: #405
    Can you provide more details in the request and why Electron is making the request fail?

  5. josephfoulds commented on Feb 12, 2019

    @josephfoulds

    Just like to chip in here and say we're experiencing the popup_closed_by_user error failure also in our React project - appears to be affecting a small % of users across a range of devices (Chrome, FireFox, Safari, Safari Mobile)

  6. bastienduran commented on Feb 12, 2019

    @bastienduran

    Hi,

    We do have the same issue. popup_closed_by_user error in our React/Electron project.
    The same code works fine in Chrome, Safari and Firefox.

    EDIT : this issue affects only users who have to signIn, already connected ones are not affected.

  7. rustemkk commented on Feb 13, 2019

    @rustemkk

    Hello,

    Same for our project, React app running in electron gives popup_closed_by_user error. Web version is fine.

    We use react-google-login and I was thinking maybe it has the issue, so I tried with simplest page with just google's suggested button and result is the same - working in browser, not working in electron.

  8. seamusml commented on Feb 14, 2019

    @seamusml

    Hi, Also can report that this is no longer working for our electron app, but is working fine in any browser.

  9. diabolic8733 commented on Feb 18, 2019

    @diabolic8733

    Any updates here? @grant

  10. grant commented on Feb 19, 2019

    @grant
    Contributor

    @JorgenPhi
    I'm not sure why this is happening for this set of applications. I've stated that I believe there's no change in gapi that would cause this.

    If there a specific something specific I can do, LMK. However, I cannot debug other projects that use this project like Electron.

  11. bastienduran commented on Feb 19, 2019

    @bastienduran

    @grant
    Of course you can not debug other projects, bug as for @JorgenPhi, there were no modifications on the electron app.

  12. bodhi3032 commented on Feb 19, 2019

    @bodhi3032

    @grant
    Perhaps some more info will help:
    I too am seeing this in my electron project. With no changes in our code, no changes to the electron base, our google authentication flow began failing and only giving a message of "popup_closed_by_user". We regressed against prior releases, also known to be previously working and found them to all fail the exact same way.

    It is unlikely that this change is anything other than a change to the auth api given the steps we took to verify the issue and the google authentication being the only common factor.

    Was something changed in policies? Is this a part/byproduct of the g+ shutdown (we are in the process of removing g+ for auth and profile info)?

    Our project uses electron-prebuilt and was tested against 3.x and 4.x builds. All fail with the same error.

    Apologies for the callout, we have thousands of users affected by this and having some support would be great.

  13. bodhi3032 commented on Feb 19, 2019

    @bodhi3032
  14. manelpb commented on Feb 21, 2019

    @manelpb

    Any update about this issue? I'm also having the same problem

  15. grant commented on Feb 21, 2019

    @grant
    Contributor

    Note: I do not work on this library. I just work at Google and help all over.

    I have notified the Google team this issue.
    My unofficial guess is that G+ login/changes may be related.
    I will report the answer I receive as soon as I get one from the gapi team.

  16. 17 remaining items

  17. wrksp-andreas commented on Jul 16, 2020

    @wrksp-andreas

    Seems to be happening again. Same symptoms as listed previously. Everything works fine in chrome, but is busted in electron.

  18. imvenky commented on Jul 20, 2020

    @imvenky

    Hey, I'm also facing the same issue, it works in my machine but not working in my colleague's machine, please help me to fix this.

  19. edouardmercier commented on Oct 2, 2020

    @edouardmercier

    For those still struggling with the popup_closed_by_user issue on Electron, just to let you know that in order to fix this issue, you need to set the BrowserWindow.webPreferences.nativeWindowOpen property to true (this is required from Electron v8.2.4) on the window which hosts the Google sign-in button.

  20. IbrahimShamma99 commented on Nov 15, 2020

    @IbrahimShamma99

    It also happens in React App all browsers with me

  21. macgill4444 commented on Dec 11, 2020

    @macgill4444

    @edouardmercier thank you so much! That fixed the issue for us on electron!

  22. dev-neeraj-maurya commented on Sep 3, 2021

    @dev-neeraj-maurya

    I'm also facing the same issue with Electron. Working fine on Chrome.

  23. afrieirham commented on Sep 24, 2021

    @afrieirham

    For those still struggling with the popup_closed_by_user issue on Electron, just to let you know that in order to fix this issue, you need to set the BrowserWindow.webPreferences.nativeWindowOpen property to true (this is required from Electron v8.2.4) on the window which hosts the Google sign-in button.

    I can verify this works, thank you for this 👍

  24. jhkcia commented on Feb 18, 2022

    @jhkcia
  25. maradanasai commented on Apr 5, 2022

    @maradanasai

    I'm getting this error even in chrome if I login in incognito tab. I'm using the following code

    <script src="https://apis.google.com/js/client:platform.js?onload=renderButton" async defer></script>
        <script>
            function renderButton() {
                gapi.load('auth2', function () {
                    auth2 = gapi.auth2.init({
                        client_id: 'xxxxx',
                        scope: 'profile email',
                    });
                });
            }
        </script>
    .............
    ..............
    function onSuccess(result) {
            console.log(result);
    
            authenticate(result.code)
                .then(res => {
                    token = res.data.token;
                    console.log(res);
                })
                .catch(console.log);
        }
    
        function authenticate(code) {
            return axios.post('http://localhost:8080/auth/google', JSON.stringify({code}));
        }
        .............
     function onClickSignIn() {
            auth2.grantOfflineAccess()
                .then(onSuccess)
                .catch(onFailure);
        }   
    
    
  26. bedamatta05 commented on May 17, 2022

    @bedamatta05

    Facing the same issue in react app in all browser. Someone please help.

  27. dvanderb commented on May 17, 2022

    @dvanderb
    Contributor

    For authentication/authorization issues please note that gapi.auth2 has been deprecated and replaced with Google Identity Services. See https://developers.googleblog.com/2021/08/gsi-jsweb-deprecation.html for more information. If you have questions related to authentication/authorization please look at the associated documentation or post questions on Stack Overflow with the google-oauth tag.

  28. dev-neeraj-maurya commented on May 21, 2022

    @dev-neeraj-maurya
  29. bedamatta05 commented on May 21, 2022

    @bedamatta05
  30. dev-neeraj-maurya commented on May 24, 2022

    @dev-neeraj-maurya
  31. dev-neeraj-maurya commented on Oct 11, 2022

    @dev-neeraj-maurya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions