Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Node module to integrate your Node app with Facebook oauth authentication

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json


Node.js module to integrate quickly your Node app with Facebook OAuth authentication

How to use it

1. create your Facebook app on Facebook Developers

2. install FAuthentication

    npm install fauthentication

3. specify settings for FAuthentication (with settings of your Facebook app)

/* import fauthentication */

var fauthentication=require('fauthentication')

/* set FAuthentication's options (parameters of Facebook app and callbacks) */

    client_id: 'your-app-id',
    client_secret: 'your-app-secret',
    redirect_uri: 'http://your-site-domain:your-port/fauthentication/getAccessToken',
    app: app,
    callback: function(accessToken){

        console.log('now you have access token',accessToken);
            console.log('Facebook user data',user);
            // here you can save user, log in...


4. bind the urls of your application with FAuthentication's request handlers

/*  set FAuthentication's url*/

app.get('/fauthentication/getAccessToken',fauthentication.getAccessToken) /* this must be according to `redirect_uri` settings (see above) */

5. In your login page insert a button to login and corresponding javascript function to open Facebook dialog box

    <script type="text/javascript">
        var login=function(){
  '/fauthentication/authenticate?next=/', 'Facebook Login', 'width=300px, height=300');
    <button onclick="login()">Facebook Login</button>       

Try with examples

git clone fauthentication

cd fauthentication/examples/fauthentication-with-express

npm install

node app.js

// now in your browser go to http://localhost:3000/ 

Something went wrong with that request. Please try again.