Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

facebook-signed-request

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

facebook-signed-request

Facebook Signed Request de- and encoder for node.js

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

facebook signed request for node.js

node.js port of facebook-signeded-request. It implements the signed request sent by facebook to applications.

Installation and Usage

clone this repository and then

var SignedRequest = require(PATH_TO_LIB + '/lib/facebook-signed-request');
SignedRequest.secret = "your facebook application secret";
var request = yourRequestObjectParamsHash['signed_request'];
var signedRequest = new SignedRequest( request );

signedRequest.parse(function(errors, request){
  // check if request was valid
  console.log(request.isValid());

  // access errors
  console.log(errors);

  // this is your data object
  console.log(request.data);
});

You can also sign requests to be used in your tests

SignedRequest.secret = "897z956a2z7zzzzz5783z458zz3z7556";
SignedRequest.encodeAndSign({ user_id : '111111'})

which will output something in the format of

gI7hojzSUZyrEP6/kh7TRCI6PZ6VucX0bvbcKxj10HY.eyJ1c2VyX2lkIjoiMTExMTExMSJ9

Data sent by facebook

Here is an example

{
	algorithm: 'HMAC-SHA256',
	expires: 1308988800,
	issued_at: 1308985018,
	oauth_token: '111111111111111|2.AQBAttRlLVnwqNPZ.3600.1111111111.1-111111111111111|T49w3BqoZUegypru51Gra70hED8',
	user: { country: 'de', locale: 'en_US', age: { min: 21 } },
	user_id: '111111111111111'
}

Tests

npm install jasmine-node
jasmine-node spec

FAQs

Package last updated on 25 Aug 2011

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc