使用uxMode ='redirect'-> react-google-login时不会触发onSuccess吗? [英] onSuccess not triggering while using uxMode='redirect' ->react-google-login?

查看:284
本文介绍了使用uxMode ='redirect'-> react-google-login时不会触发onSuccess吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用react-google-login组件通过google帐户进行用户登录,但我遇到了问题.如果我使用 uxMode ='popup'

I am using react-google-login component to make user login through google account I have an issue in that. If I use uxMode='popup'

onSucess方法正在触发,但如果我使用uxMode ='redirect',则不会触发相同的方法 `

onSucess method is triggering but the same method is not triggering if i use uxMode='redirect' `

    <GoogleLogin
clientId="*****"
scope= "profile"
buttonText="Login with Google"
uxMode='redirect'
redirectUri="http://localhost:3000"
onSuccess={responseGoogle}
onFailure={responseGoogle}/>`

推荐答案

您错过了在末尾添加斜杠即/的问题

You missed adding the trailing slash i.e / to

1)redirectUri,即redirectUri ="http://localhost:3000/"

1)redirectUri i.e redirectUri="http://localhost:3000/"

2)还请确保在 https://下的授权重定向URI中添加结尾斜杠,即/. console.developers.google.com/.它也应该是 http://localhost:3000/

2)Also make sure that you have added trailing slash i.e / in Authorized redirect URIs under https://console.developers.google.com/. It should also be http://localhost:3000/

<GoogleLogin
clientId="*****"
scope= "profile"
buttonText="Login with Google"
uxMode='redirect'
redirectUri="http://localhost:3000/"
onSuccess={responseGoogle}
onFailure={responseGoogle}/>`

不要错过斜杠.

这篇关于使用uxMode ='redirect'-&gt; react-google-login时不会触发onSuccess吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆