reactjs - Google O Auth 在本地服务器上工作,但在 nelify 上部署后没有(每次都调用 onFailure)
问题描述
<GoogleLogin
clientId="id from google o auth "
render={(renderProps) => (
<Button className={classes.googleButton} color="primary" fullWidth onClick={renderProps.onClick} disabled={renderProps.disabled} startIcon={<Icon />} variant="contained">
Google Sign In
</Button>
)}
onSuccess={googleSuccess}
onFailure={googleFailure}
cookiePolicy="single_host_origin"
/>
const googleSuccess = async (res) => {
const result = res?.profileObj;
const token = res?.tokenId;
try {
dispatch({type: "AUTH", data: {result, token}})
history.push("/");
} catch (error) {
console.log(error)
}
}
const googleFailure = () => {
console.log("Google Login Failure...")
在 netlify 上部署时,google oAuth 出现错误。我已经在 Google Console Api 凭据中添加了 URL 和重定向,但是每次按下按钮并点击任何电子邮件时,仍然有 onFailure 功能正在运行......
解决方案
推荐阅读
- rust - 为什么不能将盒装结构作为特征借用?
- php - XAMPP:Laravel 6.0 的 htdocs 文件夹权限
- javascript - 在点击反应时切换字体真棒图标
- sql - 在 Postgres 中是否可以从客户端跟踪查询 PID?
- python - 使用正则表达式查找逗号由数字分隔的事件
- makefile - Makefile:添加目录并修改路径中的扩展名
- sharepoint-online - 如何更改列表项的内容类型
- c++ - C/C++ 中 assert(false) 的更好替代方案
- ajax - 如何修复 laravel 404 NotFoundHttpException 错误?
- javascript - 是否有 lodash 或其他函数来搜索对象数组的数组以查找匹配的键/值?