【发布时间】:2016-11-11 13:58:57
【问题描述】:
我正在处理 express js,并且在传入的 POST 请求中,用户名和密码存在于请求的正文中,我想实现路由,以便可以将授权标头添加到传入的 req 对象中
我的路由如下:
router.route('/token')
.post(function(req,res,next){
if(req.body.client_id){
//set headers for authentication, e.g "Authorization":"Basic dskvnksnsnjsnvsnlvnsd"
next();
}
},authController.isClientAuthenticated,oauth2Controller.token);
【问题讨论】:
-
将它们设置在
req.headers
标签: javascript node.js express routing