Using passport.js to connect a local strategy to another (Facebook, Twitter, Google, etc)
I was using passport.authenticate when I should have been using passport.authorize!
docs here: http://passportjs.org/guide/authorize/
I've created a sample for that see https://github.com/fpp/drywall
It allows to associate one or more social accounts with a local strategy user, create local strategy users from social accounts, plus add/remove social accounts from these users.
Currently twitter & github are implemented - just add other passport versions and adjust the code sample for more services.
The sample uses Node.js 0.8x, express 3.x and backbone.js - includes some basic user management from the http://jedireza.github.com/drywall/ sample project.
P.S. I could not get a second route (for the same social service) / authorize vs authenticate with passport working as described in the passport documentation. Use
passReqToCallback: true
in the strategy instead and work on the user (see example for more).