node.js - 如何使用 express-oauth-server 进行身份验证?
问题描述
我想为我的应用程序使用 nodejs 实现 oAuth2 服务器,我正在使用https://niceprogrammer.com/express-js-oauth-2-server-using-oauth2-server-package/上的教程
但是,当我转到 https://localhost:3000/oauth/authenticate (登录路由)并尝试登录时,我得到一个 json 响应:{"error":"invalid_request","error_description":"Missing parameter: `client_id`"}
负责鉴权的函数如下:
router.post('/oauth/authenticate', async (req, res, next) => {
let UserModel = mongoose.model('User');
req.body.user = await UserModel.findOne({ username: req.body.username });
return next();
}, oauth.authorize({
authenticateHandler: {
handle: req => {
return req.body.user;
}
}
}));
教程有问题还是我做错了什么?
解决方案
我已经解决了,我?client_id=xxx
在网址中丢失了。
推荐阅读
- c#-4.0 - 使用 IDM 对象从 FileNet IDM 下载文件
- c# - 消息主题中的 MS Graph SDK 搜索返回错误
- c# - 隐藏窗口而不是关闭窗口时的性能影响
- c++ - 如何在 qml 中访问 QVector 的选定元素?
- aws-lambda - Lambda Cognito - 密码更改 - 无效的访问令牌
- sapui5 - 由于 Fiori 启动板设计器中缺少磁贴模板而无法部署
- python - Python Tkinter Treeview 固定宽度和可变 SQL 查询
- karate - 如何在空手道响应的黄瓜报告中添加/打印。
- python - 向Hbase插入数据的最快方法是什么?
- android - 如何以编程方式在双卡移动的情况下为双卡获取 CID 和 LAC?