React-google-login: auth2.signIn promise not resolved

Created on 9 Feb 2018  路  4Comments  路  Source: anthonyjgrove/react-google-login

Hi,

I implemented your component in one of my websites and noticed that some users cannot login successfully. Finally I was able to debug the issue on my coworkers's computer (he uses Safari 11.0.3, but it also happened earlier in version 10, and I myself, using 11.0.2, cannot reproduce this issue, so I don't think the browser is the issue).

So what happens is: he clicks the Google Login Button, a popup is shown listing his Google accounts, he clicks an account, and then nothing happens.

While diving into the code a bit, it turns out that the auth2.signin Promise inside the signIn method is not resolved.

auth2.signIn(options).then(res => this._handleSigninSuccess(res), err => onFailure(err))

I searched a bit for related issues and found a few (e.g. https://github.com/google/google-api-javascript-client/issues/277 and https://github.com/google/google-api-javascript-client/issues/232) also , but was not able to solve the issue myself with the suggested solutions (e.g. https://github.com/google/google-api-javascript-client/issues/232#issuecomment-278348739). But it definitely seems to be an issue with Google's auth2 library?

Has anyone experienced this issue? Any pointers how to proceed? Thanks in advance!

bug

Most helpful comment

I think I'm getting the same error, though, it appears immediately after clicking on button
google-login.js:1 Uncaught TypeError: Cannot read property 'signIn' of null

Though it never worked for me. I've just installed it and added this

import { GoogleLogin } from 'react-google-login';

<GoogleLogin
    clientId={process.env.GOOGLE_KEY}
    onSuccess={onLogin}
    onFailure={onReject}
/>

All 4 comments

I think I'm getting the same error, though, it appears immediately after clicking on button
google-login.js:1 Uncaught TypeError: Cannot read property 'signIn' of null

Though it never worked for me. I've just installed it and added this

import { GoogleLogin } from 'react-google-login';

<GoogleLogin
    clientId={process.env.GOOGLE_KEY}
    onSuccess={onLogin}
    onFailure={onReject}
/>

Hmm, I actually don't get _any_ error!

Did you make sure your browser is not blocking any third-party cookies (due to some browser extension) etc.? Can you reproduce the issue in a private session?

@tirli I'm having your exact problem. It happens intermittently.
screen shot 2018-02-09 at 10 54 57 am

I do not think the button should be enabled until google auth2 has initialized.
https://github.com/anthonyjgrove/react-google-login/blob/master/src/GoogleLogin.js#L42 should be moved to before or after https://github.com/anthonyjgrove/react-google-login/blob/master/src/GoogleLogin.js#L47

@phamcharles This issue is observed when I build through maven. But when I run it locally it is fine. Did you find out a solution for this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SSR
rlancer picture rlancer  路  8Comments

deitas picture deitas  路  8Comments

zoripong picture zoripong  路  7Comments

MitulGedeeya picture MitulGedeeya  路  3Comments

MiLeung picture MiLeung  路  4Comments