javascript - React google Login firing error on render and after sign in - Stack Overflow

So, I am starting to use React-Google-Login to create a sign in button, I pretty much followed the docu

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" onSuccess={onSuccess} isSignedIn={true} />;
};

As soon my ponent 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 ?

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." onSuccess={onSuccess} isSignedIn={true} />;
};

As soon my ponent 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 ?

Share Improve this question asked Mar 15, 2019 at 7:45 vbotiovbotio 1,7245 gold badges29 silver badges58 bronze badges 2
  • Did you resolve this issues – Sanjiv Commented Sep 2, 2019 at 13:11
  • @Sanjiv yes. I will add an response so you can check – vbotio Commented Sep 4, 2019 at 0:44
Add a ment  | 

2 Answers 2

Reset to default 3

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 ponent itself:

<GoogleLogin clientId="MYTOKEN.apps.googleusercontent." onSuccess={onSuccess} onFailure={err => console.log('fail', err)} isSignedIn={true} />;

For me the problem was solved by enabling cookies. It seems that the GoogleLogin ponent requires cookies to function and that my chrome browser had been blocking it's attempts to access them.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745549596a4632507.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信