Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expressjs FB login without Passport.js or everyauth

I've been searching for hours but can't find a Facebook login solution for Express without Passport or Everyauth. Are there any examples or tutorials about server-side oAuth 2.0 FB login for nodejs? Or is there a way to use the default express sessions and let passport only handle the initial authentication without serializing/deserializing?

like image 385
anges244 Avatar asked Jan 11 '15 03:01

anges244


1 Answers

I write / maintain the express-stormpath library which does this for ya.

Here's an example app (in it's entirety):

var express = require('express');
var stormpath = require('express-stormpath');

var app = express();
app.use(stormpath.init(app, {
  application: 'https://api.stormpath.com/v1/applications/xxx',
  secretKey: 'some_long_random_string',
  enableFacebook: true,
  social: {
    facebook: {
      appId: 'xxx',
      appSecret: 'xxx',
    }
  },  
}));

app.listen(3000);

Obviously, this requires you to create a Facebook app and setup some config options, this doc explains how to do it: https://docs.stormpath.com/nodejs/express/product.html#use-facebook-login

Hope that helps =)

like image 154
rdegges Avatar answered Sep 28 '22 00:09

rdegges