Socket
Socket
Sign inDemoInstall

facebook-sdk

Package Overview
Dependencies
0
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    facebook-sdk

A full port of Facebook's PHP SDK library


Version published
Weekly downloads
222
increased by2.78%
Maintainers
0
Install size
48.3 kB
Created
Weekly downloads
 

Readme

Source

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 (http://www.apache.org/licenses/LICENSE-2.0.html), as was the original library.

Usage

First, create a Facebook SDK object. The http request and response objects are not required for application graph requests or when setting the session manually. Otherwise they are recommended, for reading and verification of of the session from the request or cookie data, and for writing verified session data to the browser's cookie.

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

var facebook = new fbsdk.Facebook({
	appId  : 'YOUR APP ID',
	secret : 'YOUR API SECRET',
	request  : request (http.ServerRequest),
	response : response (http.ServerResponse)
});

To make API calls:

facebook.api('/me', function(me) {
	if (me.error) {
		console.log(me);
		return;
	}
	
	// do something interesting
});

Logged in vs Logged out:

if (facebook.getSession()) {
	print('<a href="' + facebook.getLogoutUrl() + '">Logout</a>');
} else {
	print('<a href="' + facebook.getLoginUrl() + '">Login</a>');
}

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 that are not relevant in the new environment have been removed.

Keywords

FAQs

Last updated on 03 Mar 2011

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