Using Everyauth/Express and Multiple Configurations? Using Everyauth/Express and Multiple Configurations? express express

Using Everyauth/Express and Multiple Configurations?


Apparently I jumped the gun and wrote this before my morning cup of coffee, because I answered my own question, and it was quite easy to implement. Basically I just had to create my own custom express middleware to switch the everyauth configuration before the everyauth gets its grubby paws on the request, so...

var configureEveryauth = function(){    return function configure(req, res, next) {        // make some changes to the everyauth object as needed....                  next();    };}

and now my setup becomes:

var app = express.createServer();everyauth.facebook  .entryPath('/login/facebook')  .callbackPath('/callback/facebook');app.use(configureEveryauth());app.use(everyauth.middleware());everyauth.helpExpress(app);app.listen(8000);

Notice that I don't even bother fully configuring the everyauth Facebook object during the startup, since I know that the middleware will fill in the missing params.