javascript - reactjs 从发布的数据中捕获响应
问题描述
我在 node.js 中有以下代码
app.get('/callback', function (req, res) {
oauthClient
.createToken(req.url)
.then(function (authResponse) {
oauth2_token_json = JSON.stringify(authResponse.getJson(), null, 2);
})
.catch(function (e) {
console.error(e);
});
res.send('');
});
并传递回调如下
http://localhost:8000/authUri?json[clientId]=ABdfsdfsdcbLxxwU&json[clientSecret]=EiL8Cuasdsdfsdfl&json[environment]=sandbox&json[redirectUri]=http://localhost:8000/callback
上面的代码工作正常,但是我想在 react js 功能组件中实现这个,比如创建一个函数并给出 url,我尝试在组件内部创建一个函数说示例并给出像
“/样本”
但是不工作可以有人请建议如何做到这一点
这就是我所做的
http://localhost:8000/authUri?json[clientId]=ABdfsdfsdcbLxxwU&json[clientSecret]=EiL8Cuasdsdfsdfl&json[environment]=sandbox&json[redirectUri]=http://localhost:3000/sample
useEffect((req,res) => {
console.log(req);
},[])
我需要捕获第三方发布的数据
请帮忙,我卡在这里谢谢,
解决方案
推荐阅读
- android - Mixpanel 自定义 FCMreceiver
- automation - 无法从步骤定义类中读取并行执行中的黄瓜参数
- swift - 如何禁用 UICollectionView 中特定项目单元格的自动大小
- r - 将多列的行合并为一个(行)R
- react-native - 如果按下的组件被重新渲染,则 React Native onLongPress 触发 onPress
- go - Golang 流式 response.Body 转换成另一个 HTTP 请求体
- c++ - typedef 中的同名并从命名空间中使用
- agens-graph - 如何修改 AgensGraph 上标签的属性?
- python - ProgrammingError:关系“taggit_tag”不存在
- react-native - 如何在Android模拟器中查看keystore的内容