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
Maintainers
0
Created

Readme

Source

node.js Facebook SDK

This is a 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.

I retain the open source apache license of the original SDK. The node.js Facebook SDK is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

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 as well. It was the easiest way to confirm the new node.js library works as expected. New tests are to be added as needed for reported bugs or new features.

Keywords

FAQs

Last updated on 28 Feb 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