Hi, is there a trick to getting these two to play nice?  Whenever I
use everyauth, I get a 'webhook denied' error when I try to subscribe
to a channel.  I assume it has something to do with the auth
middleware.  The app is pretty basic:


var app = express.createServer();
app.configure(function() {
  app.use(express.bodyParser());
  app.use(express.cookieParser());
  app.use(express.session({secret: '81c8ffd963553f2ae558'}));
  app.use(everyauth.middleware());
  app.use(app.router);
  app.set('view engine', 'jade');
  app.use(express.static(__dirname + '/public'));
  app.use(express.errorHandler());
  app.use(auth.getAuthMiddleware('8906ced59cf7088b283a',
'81c8ffd963553f2ae558'));
  everyauth.helpExpress(app);
  app.use(express.logger())
});

app.get('/', function (req, res) {
  var returnVars = {
    key: '8906ced59cf7088b283a',
    layout: false,
    appTitle: appTitle,
    currentSubjects: streamer.currentSubjects()
  };

  res.render('index', returnVars);
});

app.post("/webhooks", function (req, res) {
  if (!req.web_hook_authorized) {
    console.log("WebHook denied", req.body);
    res.send({}, 403);
    return;
  }
  console.log("WebHook received", req.body);
  var events = req.body.events;
  for (var i=0; i < events.length; i++) {
    var event = events[i].name;
    var channel = events[i].channel;

    if (channel != "subjects") {
      if (event == "channel_occupied") {
        streamer.track(channel);
      } else if (event == "channel_vacated") {
        streamer.untrack(channel);
      }
    }
  };

  res.send({});
});

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to