I'm developing a simple node/express/jade website that fetch all the public feeds of a Facebook Page.

I create an application from wich i get client_id (APP_ID) and client_secret (APP_SECRET).

My code works, and it's okay but i wonder if this is the correct way of handling this need.

Here is the code:

var https = require('https'),
    concat = require('concat-stream'),
    async = require('async');

function FacebookPage(pageId) {
    if (!(this instanceof FacebookPage))
        return new FacebookPage(pageId);

    this.pageId = pageId;
}

FacebookPage.prototype.getPublicFeeds = function (callback) {

var pageId = this.pageId;

async.waterfall([

  function (done) {
        var params = {
            hostname: 'graph.facebook.com',
            port: 443,
            path: '/oauth/access_token?client_id=MY_CLIENT_ID&amp;' +
                'client_secret=MY_CLIENT_SECRET&amp;grant_type=client_credentials',
            method: 'GET'
        };

        https.get(params, function (response) {
            //response is a stream so it is an EventEmitter
            response.setEncoding("utf8");

            //More compact
            response.pipe(concat(function (data) {
                done(null, data);
            }));

            response.on("error", done);
        });
  },

  function (access_token, done) {

        var params = {
            hostname: 'graph.facebook.com',
            port: 443,
            path: '/v2.0/' + pageId + '/feed?' + access_token,
            method: 'GET'
        };

        https.get(params, function (response) {
            //response is a stream so it is an EventEmitter
            response.setEncoding("utf8");

            //More compact
            response.pipe(concat(function (data) {
                callback(null, JSON.parse(data));
            }));

            response.on("error", callback);
        });

  }]);
};

module.exports = FacebookPage;


EDIT: thank to @Tobi I can delete the part of getting the access_token by putting access_token=app_id|app_secret as explained here:



Question: How to know which edition a DotNetNuke site is
Answer: From the DotNetNuke Wikipedia page:


  The DotNetNuke Professional Edition was introduced in February 2009 with version 5.0. The DotNetNuke Elite Edition was released in September 2009.


At least these editions were not available in version 4.