!!!Unmaintained!!! Consider using fb

Downloads in past


7850.3.35 years ago12 years agoMinified + gzip package size for facebook-sdk in KB


This library is unmaintained. Consider using Facebook's client-side JS library or a more recent client side library. This is a complete port of Facebook's PHP SDK library.
The Facebook Platform is a set of APIs that make your application more social. Read more about integrating Facebook with your web site on the Facebook developer site.

The node.js Facebook SDK is licensed under the Apache License, Version 2.0, as was the original library.


npm install facebook-sdk

Use as connect middleware

The following will attach a new Facebook object to each incoming http request. For more information on querying Facebook's graph api, see developers.facebook.com.
var connect = require('connect'),
  fbsdk = require('facebook-sdk');

    appId  : 'YOUR APP ID',
    secret : 'YOUR API SECRET'
  .use(function(req, res, next) {

    if (req.facebook.getSession()) {
      res.end('<a href="' + req.facebook.getLogoutUrl() + '">Logout</a>');

      // get my graph api information
      req.facebook.api('/me', function(me) {

    } else {
        res.end('<a href="' + req.facebook.getLoginUrl() + '">Login</a>');


Stand alone usage

var fbsdk = require('facebook-sdk');

var facebook = new fbsdk.Facebook({
  appId  : 'YOUR APP ID',
  secret : 'YOUR API SECRET'

facebook.api('/YOUR APP ID', function(data) {


The tests have been ported to run using nodeunit. This was the easiest way to confirm the new node.js library works as expected. Some new tests have been added to cover edge cases, and others not relevant in the new environment have been removed.