express - Express.js POST 响应“对象移至此处”iDoklad API
问题描述
我有一个 Angular 和 Express 应用程序,它首先使用
<a href='url'></a>
登录后它会使用授权代码重定向回我的页面,因此在浏览器中我有https://faktury-12.herokuapp.com/?code=fbbe4311532df4e098f1f7086774669a - 然后我将该代码发送到后端
app.get('/oi', (req,res,next) => {
const code = req.query.code;
request.post('https://app.idoklad.cz/identity/server/connect/token&grant_type=authorization_code&client_id=cbf4f262-025e-4b2f-bf6a-0cbee25dda4a'+
'&client_secret=8a218922-b512-48x3-892e-aa2a847e141a&scope=idoklad_api%20offline_access&code=' + code +
'&redirect_uri=https://faktury-12.herokuapp.com/', (request,response)=>{
const object = response.body;
res.send(object);
})
})
并使用该授权代码从那里获取令牌,但“对象移至此处”中网络选项卡中的响应。我查了一下,发现它与重定向有关——它被设置为 null。我重置了它,但还是一样。
当我添加
res.redirect('https://faktury-12.herokuapp.com/')
之前或之后
res.send(object)
它带我回到我的主页并且没有提供任何东西
我希望 res.body 看起来像这样
{
"access_token": "eyJ0eXAi...",
"expires_in": 6000,
"token_type": "Bearer",
"refresh_token": "abcd..."
}
但它在网络选项卡中显示“对象已移至此处”
这是提到对象的href
<a href="%2fidentity%2fHome%2fE404%3faspxerrorpath%3d%2fidentity%2fserver%2fconnect%2ftokengrant_type%3dauthorization_code%26client_id%3dcbf3f192-025e-4b2f-bf6a-0cbee25dda4a%26client_secret%3d8a210622-b512-48e3-892e-aa2a847e141a%26scope%3didoklad_api%2520offline_access%26code%3d7036741cf29bf898be3186c70a573b86%26redirect_uri%3dhttp%3a%2flocalhost%3a5000%2foi">here</a>
我想了解,发生了什么
我感谢任何帮助,我已经坚持了一段时间,所以感谢您的时间
解决方案
推荐阅读
- python - 如何在python中使用循环加载不同的模型并自动保存结果?
- git - “重置后未暂存的更改”是什么意思?
- excel - 根据匹配数据填充行
- python - 如何对数据透视表中的字符串值求和?
- vue.js - 有没有办法访问 Primevue 数据表中的索引或数据值?
- ios - 斯威夫特:SFSpeech 只识别字母?
- vuejs3 - Vue 3 添加反应性类来挂载元素
- python - 如何获取numpy数组中的元素以进行索引?
- numpy - 为 SRCNN - Tensorflow 创建数据集:无法将 NumPy 数组转换为张量(不支持的对象类型 numpy.ndarray)
- javascript - 当父元素具有 CSS 属性时,赛普拉斯如何断言元素可见:显示:无