So, I am starting to use React-Google-Login to create a sign in button, I pretty much followed the documentation, but I am receiving 2 errors.
So, here is my code for now.
import GoogleLogin from 'react-google-login';
const Login = ({ classes }) => {
const onSuccess = (googleUser) => {
console.log(googleUser);
}
return <GoogleLogin clientId="MYTOKEN.apps.googleusercontent.com" onSuccess={onSuccess} isSignedIn={true} />;
};
As soon my component renders, I receive this error
Uncaught TypeError: g is not a function at google-login.js:274
but I am still able to see to button, and when I click it I receive this error when it finishes the action
Uncaught TypeError: i is not a function at google-login.js:312
So what are this errors about ? I am sure my token is right, and pretty much sure the configuration on google console is right as well.
How to solve it ?
The problem is not well documented pretty much anywhere in the official documentation and I am not really sure this is the best approach for the problem, since many people haven't the same problem when following the documentation.
My solution was adding a callback error on the component itself:
<GoogleLogin clientId="MYTOKEN.apps.googleusercontent.com" onSuccess={onSuccess} onFailure={err => console.log('fail', err)} isSignedIn={true} />;
For me the problem was solved by enabling cookies. It seems that the GoogleLogin component requires cookies to function and that my chrome browser had been blocking it's attempts to access them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With