Socket
Socket
Sign inDemoInstall

facebook-sdk

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

facebook-sdk

!!!Unmaintained!!! Consider using fb


Version published
Maintainers
1
Weekly downloads
150
decreased by-25.74%

Weekly downloads

Readme

Source

** This library is unmaintained. Consider using Facebook's client-side JS library or a more recent client side library. **

node.js Facebook SDK

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.

Install

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');

connect()
  .use(connect.cookieParser())
  .use(connect.bodyParser())
  .use(fbsdk.facebook({
    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) {
          console.log(me);
      });

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

  })
  .listen(3000);

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) {
  console.log(data);
});

Tests

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.

Keywords

FAQs

Last updated on 03 Apr 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc