Node.js Facebook示例无法在Connect auth/Express中工作
我现在正在学习这个例子。我不明白如何让这个例子起作用 在这段取自上一个链接的代码片段中:Node.js Facebook示例无法在Connect auth/Express中工作,node.js,connect,express,Node.js,Connect,Express,我现在正在学习这个例子。我不明白如何让这个例子起作用 在这段取自上一个链接的代码片段中: // Method to handle a sign-in with a specified method type, and a url to go back to ... app.get('/signin', function(req,res) { req.authenticate([req.param('method')], function(error, authenticated) {
// Method to handle a sign-in with a specified method type, and a url to go back to ...
app.get('/signin', function(req,res) {
req.authenticate([req.param('method')], function(error, authenticated) {
if(authenticated ) {
res.end("<html><h1>Hello Facebook user:" + JSON.stringify( req.getAuthDetails() ) + ".</h1></html>");
}
else {
res.end("<html><h1>Facebook authentication failed: " + error + " </h1></html>");
}
});
});
//使用指定的方法类型和返回的url处理登录的方法。。。
app.get('/signin',函数(req,res){
请求验证([req.param('method')]),函数(错误,已验证){
如果(已验证){
res.end(“你好,Facebook用户:”+JSON.stringify(req.getAuthDetails())+”;
}
否则{
res.end(“Facebook身份验证失败:+错误+”);
}
});
});
我不明白这是什么意思?很难理解
connectauth
和facebook是如何协同工作的。我一直在获取身份验证失败。身份验证的第一个参数是一系列要尝试的身份验证策略,在本例中,req.param['method']
设置在URL中(var-sign\u-in\u-link
在代码下面)到“facebook”它与使用中初始化的唯一身份验证策略相匹配
我也无法使其工作,始终无法获得Facebook身份验证。