I am trying to set up a twitter connect on my web app using the passport module
I have implemented it as follow:
App.js file:
/**
* Module dependencies.
*/
var express = require('express');
var user = require('./server/routes/user');
var http = require('http');
var path = require('path');
var app = express();
var passport = require('passport');
var flash = require('connect-flash');
require('./server/config/passport')(passport); // pass passport for configuration
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.configure(function() {
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public')));
// set up our express application
app.use(express.logger('dev')); // log every request to the console
app.use(express.cookieParser()); // read cookies (needed for auth)
app.use(express.bodyParser()); // get information from html forms
app.set('view engine', 'ejs'); // set up ejs for templating
// required for passport
app.use(express.session({ secret: 'SECRET' })); // session secret
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session
});
// // routes ======================================================================
require('./server/routes/index')(app, passport); // load our routes and pass in our app and fully configured passport
I am using express.session but i get the following error message when trying to authenticate:
Error: OAuthStrategy requires session support. Did you forget app.use(express.session(...))?
Does anyone has an idea why I get this?
var session = require('express-session'); app.use(session({ secret: 'SECRET' }));
github.com/senchalabs/connect – Unmake