Skip to content

@forste /gist:3438935
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
express facebook verify subscription creation routes
app.post('/facebook/realtimeupdates', function(req, res) {
f = ':/facebook/realtimeupdates POST cb:';
var object = req.param('object');
var entry = req.param('entry');
log.finer(__filename+f+'new notifications');
log.finest(__filename+f+'object=('+object+')');
log.finest(__filename+f+'entry=('+entry+')');
res.send(200);
});
app.get('/facebook/realtimeupdates', function(req, res) {
f = ':/facebook/realtimeupdates GET cb:';
//TODO read and implement ff
//The end point should first verify the verify_token value is what you passed to Facebook, then return the hub.challenge value. This verification technique prevents malicious apps from using the real-time feature as tool for distributed denial-of-service (DDoS) attacks.
var mode = req.param('hub.mode'),
challenge = req.param('hub.challenge'),
verify_token = req.param('hub.verify_token');
log.finer(__filename+f+'subscription verification called');
log.finest(__filename+f+'mode=('+mode+')');
log.finest(__filename+f+'challenge=('+challenge+')');
log.finest(__filename+f+'verify_token=('+verify_token+')');
res.write('challenge'); // "return" the challenge this way?
res.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.