React-google-login: Error "popup_closed_by_user"

Created on 30 Nov 2017  Â·  39Comments  Â·  Source: anthonyjgrove/react-google-login

Getting 'popup closed by user' error after choosing Google account and clicking 'Allow' in popup screen. Here is my request:
<GoogleLogin clientId='.....apps.googleusercontent.com' buttonText="Login" scope='https://www.googleapis.com/auth/drive.file' onSuccess={this.responseGoogle} onFailure={this.responseErrorGoogle}/>

Most helpful comment

Try clearing your browser cache

All 39 comments

+1 for this issue. Everything appears to work, but not getting anything in the response and seeing this error in the console.

This is likely because your google + api is not enabled. Go to Library and search for plus api. There should be a result for google plus API, please enable it and try again.

Any news on this?

I was experiencing the same problem here.
It was resolved when I re-created google credentials.

Go to https://console.developers.google.com/apis, and in the Google Plus API, access credentials, and create a new credential for "Oauth Client Id".
In the "Application Type" select "Web Application".
Be sure to put the full address of where the API is being called in the "Authorized redirect URIs".
Finally, use the new "Client ID" that will be generated.

Despite this, the message displayed ("popup_closed_by_user") is not correct, so I believe the issue should be kept open.

Also getting this error. And seems like it's random and based on loading status. Because sometimes when I wait enough, I'm not getting an error. What is more, after I added this button, sometimes I'm getting infinite loading after reload (and in this state, the button always returns popup closed by user)

+1 this issue just started occurring for me...

Also happening to me

Same for me

Try clearing your browser cache

Clearing cache can help for a while, though the main problem is that error description doesn't explain what happened. And it's what should be fixed.

Having the same issue. It works normally in chrome, but getting { error: "popup_closed_by_user" } in firefox

Clear browser cache and open new tab. It works for me.

I have the same issue in chrome only. It works in Firefox and Safari

how about this issues ?

Clear cache and refresh will work. It work for me.

Got this error on local, fixed it by including port number in the 'Authorized JavaScript origins', which is http://localhost:8000 instead of http://localhost

I fixed this issue by whitelisting

http://localhost

and adding cookiePolicy

clientId={WEB_CLIENT_ID}
buttonText="Login with LF account"
onSuccess={this.responseGoogle}
onFailure={this.responseGoogle}
cookiePolicy={'single_host_origin'}
/>

https://developers.google.com/identity/sign-in/web/reference#googleauththenoninit-onerror

2019, the issue is still present. Hit me out of nowhere.

Clearing the cache worked for me as well.

for me, every time you have this error is because something is miss-configured, google or code.

worked after clearing browser cache and cookies

I have a website deployed that serves a number of domains. All my .com domains on this hosted site work fine but my .dev site simply will not work unless I use an incognito browser. I can even open a new computer and visit the site for the very first time and I get an error. (All browsers)
Response from the iframe request : {"valid":false}
Does anyone have any insight as to why?

Response from the iframe request : {"valid":false}
Does anyone have any insight as to why?

@retzion Configure your Authorized JS origin & redirect URI as mentioned in https://stackoverflow.com/a/53510968/8254487

Just cleared 1.3gb of cookies and cache but still no gain. Each time I try to sign up I get invalid client, right after setting http://localhost:3000 in google credentials

Clearing the cache doesn't strike me as a good solution if you're trying to make sure your users aren't hit with this error.

This solution worked for me: https://github.com/anthonyjgrove/react-google-login/issues/132#issuecomment-458029717

This is how I got it to work in Chrome,
Go to Setting -> Advanced -> Clear browsing data -> Cached images and files -> Clear Data
Also try this, going to site settings and make sure you allow 'Popups and redirects'

09/2019 Still facing this issue, quite sad...

My colleagues on Mac and Windows face this problem as well. But on Mac more frequently

Check your browser plugins... Disable some which could potentially block trackers. In my case it was Privacy Badger

any updates regarding on the issue?

no because you need the hash string as well to decode the jwt token, and
your server-side code using the GoogleClientSecret

here is my working example:
https://github.com/WebJamApps/web-jam-back/blob/dev/auth/google.js

On Fri, Jul 17, 2020 at 8:42 AM AminRafaey notifications@github.com wrote:

Hello everyone,
Using OAuth 2.0 Client ID directly in the client-side will not expose our
credentials? Anyone can go into the console of browser and after getting
this id can use it for getting data from google on our behalf

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/anthonyjgrove/react-google-login/issues/132#issuecomment-660085330,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADFY3WB3F7WPXVAYIUVL3LLR4BBKLANCNFSM4EGE3MKQ
.

--
Josh Sherman
https://web-jam.com
https://www.linkedin.com/in/joshuavsherman/
540-494-8035

Check your browser plugins... Disable some which could potentially block trackers. In my case it was Privacy Badger

Thanks! Unlocking google domains in privacy badger has helped me.

I fixed the issue in my chromium-browser. I tried to clear my cache, but no change. The issue for me seemed to be that third parties cookies are not allowed. I am using localhost:3000/8000, client/server. chromium>settings>privacy& security>allow all cookies. I don't like this solution all that much though.

EDIT: ah, I found this in the documentation: https://www.npmjs.com/package/react-google-login#onfailure-callback

  • initialization of the Google Auth API failed (this will occur if a client doesn't have third party cookies enabled)

In my case, I was using incognito mode in Chrome and was facing this error.
Turns out, that this issue is because cookies are not enabled in incognito mode/guest mode.
This could be a possible workaround - https://stackoverflow.com/questions/63631849/google-sign-in-not-working-in-incognito-mode , I haven't tried it out yet though

02/21: I just bumped into this issue on Chrome. Clearing the Cached images and files did fix the issue.

So having this issue opened in 2021 means this is still outstanding. Of course clearing cache solves the problem but this cannot be the ultimate solution telling your users to clear cache all the time they have to use the site.

Will we ever get this fixed?

This same is there with me I have just stop blocking cookies at the top right there is an eye just click on that allow all cookies

This solved my issue
image

I'm running this in an ElectronJS app, can't find any docs about how to enable 3rd party cookies, so had to force a reload when this specific error shows and hope it was actually logged correctly, anyone knows how to fix this in Electron?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emwee picture emwee  Â·  4Comments

Ethan0007 picture Ethan0007  Â·  3Comments

MiLeung picture MiLeung  Â·  4Comments

Praneetha-CK picture Praneetha-CK  Â·  3Comments

MitulGedeeya picture MitulGedeeya  Â·  3Comments