Login to NodeBB using Facebook access token?

NodeBB Plugins
  • Hey guys,

    I'm developing an app for my forum.

    So far, I've managed to get the Facebook Login in a native way:

    Facebook App opens and user authorizes the app.

    It returns the access_token and the user info.

    My question: How can I use the access_token and send it to NodeBB in order to:

    a ) login if the user has registered in the past
    b ) create an account

    I'm using julian's SSO-Facebook plugin and all my users are registered via Facebook.

    Edit: I'm checking the sso-facebook plugin and passport.js to see if I can (somehow) send the response I get to /auth/facebook/callback

     

    I've also found: https://github.com/drudge/passport-facebook-token

    But I'm having trouble figuring out how to implement it on NodeBB's /src/routes/authentication.js

    Any clue?

    @julian @psychobunny ?

  • Ok, so far I've got it to work using passport-facebook-token and changing julian's sso-facebook plugin:

    	FacebookTokenStrategy = require('passport-facebook-token'),
    

    and changing:

    		passport.use(new passportFacebook({
    

    to

    		passport.use(new FacebookTokenStrategy({
    

    Also:

    		strategies.push({
    			name: 'facebook',
    			url: '/auth/facebook',
    			callbackURL: '/auth/facebook/callback',
    			icon: constants.admin.icon,
    			scope: 'email, user_friends'
    		});
    

    to

    		strategies.push({
    			name: 'facebook-token',
    			url: '/auth/token',
    			callbackURL: '/auth/token/callback',
    			icon: constants.admin.icon,
    			scope: 'email, user_friends'
    		});
    

    I'm able to log into my account but I get this error:

    0_1499144571635_Screen Shot 2017-07-04 at 00.02.37.png

    Why is the route not found?


Suggested Topics