🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

fb_oauth

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fb_oauth

simple facebook integration module

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

fb_oauth

npm version

NPM

simple node express middleware for facebook integration

fb_oauth is ease of use express middleware which implements facebook authentication(OAuth2.0). you can integrate facebook API authentication simply by adding fb_oauth to your nodejs application. below code example shows how to register fb_oauth into the express based app.
var express = require('express');
var fb = require('fb_oauth');

var app = express();
app.use(fb({
    client_id : 'YOUR CLIENTID',
    client_secret : 'YOUR CLIENTSECRET'
}));
below code example show how you can initiate oauth flow. fb_oauth use EventEmitter for result delivery so you have to add listener if you want to get valid token.
var express = require('express');
var router = express.Router();
var fb_oauth = require('fb_oauth').OAuth;



router.get('/login', function(req, res, next) {

    fb_oauth.on(fb_oauth.Events.ON_SUCCESS, function(token){
           /*you can get valid token here*/
    });

    fb_oauth.on(fb_oauth.Events.ON_FAIL, function(err) {
           /*handle error condition here*/
    });
    fb_oauth.authenticate(req,res,['public_profile','email'],{
        onsuccess : '/',    /*if authentication is successful,client will redirect to '/' */
        onfail : '/fail'    /*if authentication fails, client will redirect to '/fail' */
    });
});

Keywords

facebook

FAQs

Package last updated on 03 May 2016

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