node.js - Passportjs facebook authentication is blocking my application -
modules:
"express": "~3.0.0", "jade": ">= 0.0.1", "mongoose": ">= 3.6.2", "connect-mongo": "0.3.2", "nodemailer": ">= 0.3.20", "socket.io": "0.9", "cookie": "0.0.5", "passport": "0.2.3", "passport-facebook": "*", "underscore": "*" -- backend --
expressjs configuration:
app.configure(function(){ app.set('port', process.env.port || 3000); app.set('views', config.root + '/app/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.limit('1mb')); app.use(express.bodyparser()); app.use(express.methodoverride()); app.use(express.cookieparser('')); app.use(express.session()); app.use(express.static(path.join(config.root, 'public'))); // express/mongo session storage app.use(express.session({ secret: '', store: new mongostore({ url: config.db, collection : 'sessions' }) })); app.use(passport.initialize()); app.use(passport.session()); app.use(app.router); }); in routers:
app.get('/login/facebook', passport.authenticate('facebook', { display: 'popup', scope: [ 'email', 'user_about_me'], failureredirect: '/' })); app.get('/login/facebook/callback', passport.authenticate('facebook', { failureredirect: '/' }), user.callbacklogin); in user.callbacklogin :
exports.callbacklogin = function(req, res){ res.render('callback_login'); }; callback_login view has js script close window login popup.
-- frontend --
utils.popupcenter = function(url, width, height, name) { var left = (screen.width/2)-(width/2); var top = (screen.height/2)-(height/2); return window.open(url, name, "menubar=no,toolbar=no,status=no,width="+width+",height="+height+",toolbar=no,left="+left+",top="+top); }; utils.popupcenter('login/facebook', 600, 400, 'facebook login'); i'm having troubles passportjs integration. popup works, facebook login called, , when click in 'ok' facebook returns data , passport saves in mongodb. but, after point, nothings works. expressjs blocking requests. when try access url nodejs stay busy. after spends time i'm receiving message "no data received".
i know it's quite late answer, try project put together:
https://github.com/rafaelfaria/passportjs-facebook-client-auth
i hope that's looking for.
Comments
Post a Comment