【发布时间】:2013-03-13 12:49:22
【问题描述】:
我在使用 http-auth 模块创建基于 express 的 node.js 应用程序时遇到问题。
可以为这个 http-auth 库创建中间件我有这个代码:
//Configure Middlewares
logger.configure(function() {
//All output has content type json
logger.use(function(req, res, next) {
res.contentType('application/json');
next();
});
//Create digest auth middleware
logger.use(function(req, res, next){
digest.apply();
next();
});
});
应用此功能后,当我连接到站点时出现此错误:
TypeError: Cannot read property 'headers' of undefined
有没有办法解决这个问题或使用其他方法?
我需要对整个应用程序进行摘要身份验证。
【问题讨论】:
-
logger 是 express 应用的实例。
-
只需使用适当的模式将
http-auth与connect集成。
标签: node.js express http-authentication digest-authentication http-auth