react-google-login icon indicating copy to clipboard operation
react-google-login copied to clipboard

GoogleLogin button is making requests to google api without user interaction.

Open MrUsefull opened this issue 5 years ago • 16 comments

I've created a demo app here demonstrating the behavior.

Here are request logs for the demo app above after running npm start with no user interaction:

GEThttp://localhost:3000/ [HTTP/1.1 304 Not Modified 1ms]

GEThttp://localhost:3000/static/js/bundle.js [HTTP/1.1 304 Not Modified 1ms]

GEThttp://localhost:3000/static/js/0.chunk.js [HTTP/1.1 304 Not Modified 16ms]

GEThttp://localhost:3000/static/js/main.chunk.js [HTTP/1.1 304 Not Modified 18ms]

GEThttp://localhost:3000/static/js/0.chunk.js [HTTP/1.1 200 OK 0ms]

GETws://localhost:3000/sockjs-node [HTTP/1.1 101 Switching Protocols 5ms]

GEThttps://apis.google.com/js/api.js [HTTP/2 304 Not Modified 40ms]

GEThttps://apis.google.com/js/api.js [HTTP/2 200 OK 0ms]

GEThttps://apis.google.com//scs/apps-static//js/k=oz.gapi.en_US.sazTpAB7NWc.O/m=auth2/rt=j/sv=1/d=1/ed=1/am=wQE/rs=AGLTcCMGRnMhese6OTxesnN0rDvhruAGIg/cb=gapi.loaded_0 [HTTP/2 200 OK 0ms]

GEThttps://apis.google.com//scs/apps-static//js/k=oz.gapi.en_US.sazTpAB7NWc.O/m=auth2/rt=j/sv=1/d=1/ed=1/am=wQE/rs=AGLTcCMGRnMhese6OTxesnN0rDvhruAGIg/cb=gapi.loaded_0 [HTTP/2 200 OK 0ms]

GEThttp://localhost:3000/logo192.png [HTTP/1.1 200 OK 0ms]

GEThttp://localhost:3000/favicon.ico [HTTP/1.1 200 OK 0ms]

GEThttps://accounts.google.com/o/oauth2/iframe#origin=http%3A%2F%2Flocalhost%3A3000&rpcToken=432349172.2282647 [HTTP/2 200 OK 43ms]

GEThttps://ssl.gstatic.com/accounts/o/299200676-idpiframe.js [HTTP/2 200 OK 0ms]

GEThttps://ssl.gstatic.com/accounts/o/299200676-idpiframe.js

MrUsefull avatar Dec 18 '20 20:12 MrUsefull

I am also having this same issue. The request is being sent without interaction.

jblevins1991 avatar Jan 05 '21 23:01 jblevins1991

I'm facing the same issue

Migggz avatar Jan 06 '21 23:01 Migggz

yes I was facing this same issue. use prop autoLoad={false} this will solve the issue

krishnaTORQUE avatar Jan 25 '21 19:01 krishnaTORQUE

The demo repo shows the issue with autoload set to false: https://github.com/MrUsefull/react-google-login-auto-demo/blob/master/src/App.js

MrUsefull avatar Jan 26 '21 21:01 MrUsefull

any update on this?

pankajchaturvedi2244 avatar Mar 31 '21 07:03 pankajchaturvedi2244

i also face this issue

<GoogleLogin
                          className="btn btn-dark-outline btn-lg"
                          render={(renderProps) => (
                            <CButton
                              block
                              color="dark"
                              variant="outline"
                              size="lg"
                              onClick={renderProps.onClick}
                            >
                              <img
                                className="mr-3"
                                width="18"
                                src={googleIcon}
                                alt="icon"
                              />
                              Sign up with Google
                            </CButton>
                          )}
                          clientId={
                            process.env.REACT_APP_GOOGLE_CLIENT_ID 
                          }
                          onSuccess={handleGoogleSignUp}
                          onFailure={handleGoogleSignUp}
                          cookiePolicy={"single_host_origin"}
                          autoLoad={false}
                          isSignedIn={false}
                        />

adeeltechmate avatar Aug 02 '21 09:08 adeeltechmate

any update on this? project seems inactive.

on page load, the onSuccess callback will be triggered automatically, even if I set autoLoad = {false}

zhuhang-jasper avatar Oct 04 '21 05:10 zhuhang-jasper

Looks like the lack of error handling creates this issue. same here. In my case the error was {error: 'idpiframe_initialization_failed', details: 'Cookies are not enabled in current environment.'} So basically the button checks the config and throws an error immediately after rendering

bohdan-vasylenko avatar Oct 27 '21 12:10 bohdan-vasylenko

Is there any workaround for this issue? autoload prop doesn't work.

Is there any similar lib like this? Critical bug that we can't release with.

mcmxcdev avatar Jan 16 '22 06:01 mcmxcdev

Same here : onAutoLoadFinished is called with 'true' even if autoLoad is set to false.

tutanck avatar Feb 08 '22 10:02 tutanck

when run it on http, I got the issue. after run it on https there was no auto calling issue.

NimaChamika avatar Mar 08 '22 00:03 NimaChamika

If your browser is blocking third-party cookies, then Google with throw an error as soon as the button renders. The workaround would be to store whether the the button has been clicked, and then display the error only after the button has been clicked. Note the error thrown post-click is often different from the error thrown pre-click.

lukestewart13 avatar Mar 24 '22 12:03 lukestewart13

Any update on this? The prop autoload doesn't work.

rcastro-uy avatar Jun 06 '22 18:06 rcastro-uy

I faced to same issue. i resolved it just using
onAutoLoadFinished={true} it may help.

sardar-ali avatar Jul 28 '22 12:07 sardar-ali

This is also not working and it is rendering automatically. Can someone please have a look at this ?

ghost avatar Aug 04 '22 08:08 ghost

autoLoad property isn't working for me too. any workarounds?

SpurgeonPrakash avatar Sep 10 '22 14:09 SpurgeonPrakash