Expressjs FB login without Passport.js or everyauth
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 =)
This will give you data on alert ,, use FB AppId
<div id="fb-root"></div> <script src="https://connect.facebook.net/en_US/all.js"></script> <script> var facebookAppId = 'XXXXXX'; var _fBAccessToken =''; window.fbAsyncInit = function() { FB.init({ appId: facebookAppId, xfbml: true, version: 'v2.0', status: true, cookie: true, oauth: true }); FB.getLoginStatus(function(response) { if ((response.status)&&(response.status=='connected')) { userId = response.authResponse.userID; _fBAccessToken = response.authResponse.accessToken; FB.api('/me', function(responsed) { alert(JSON.stringify(responsed)) },{scope:'public_profile,email'}); })</script>
the only useful documentation for vanilla node.js / express authentication i've managed to find is facebook's: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/
you have to set up apps (a test app for dev / localhost and a prod app that'll be live) at https://developers.facebook.com/apps first, but once that's done it's the standard oauth procedure with only a couple of facebook-specific options