shrw
shrw

Reputation: 1795

NodeJS social + authorization with Passport or Everyauth

My question may be a little trivial since I am coming from Java background.

I have need the following with Node.js

  1. User should be able to connect to multiple social sites like Facebook, Google and Twitter at the same time.
  2. Site/module must be able to send Auth requests to each connected sites (requests may be different, but should be able to send), like posting to the wall, tweeting etc.
  3. The user (who may be connected to multiple accounts) must be able to have roles and the server-side (Node.js) will only allow actions to be performed by a set of roles.

I am also planning to use MeteorJS, does it have any implications? Do these libraries work well with each other?

I am not sure if my requirements are possible, please suggest. (may be with examples.)

Upvotes: 0

Views: 904

Answers (1)

enducat
enducat

Reputation: 1706

https://github.com/ganarajpr/express-angular definitely covers a quite a few of your requirements and works out of the box as a seed for a web app.

It supports Google, facebook and twitter integration using everyauth.

To make posts to the a Facebook wall, you would only need the request module once you are authenticated

See http://runnable.com/UTlPM1-f2W1TAABY/post-on-facebook for a live demo

As for group based roles, there are multiple ways of implementing this:

  1. Use https://github.com/ForbesLindesay/connect-roles, ex:

    app.get('/', function (req, res) {
      if (req.user.is('admin')) {
        res.render('home/admin');
      } else if (user.can('login')) {
        res.render('home/login');
      } else {
        res.render('home');
      }
    })
    
  2. Use regular express routing, for an example please see Group/rule-based authorization approach in node.js and express.js

Hope this helps.

Upvotes: 0

Related Questions