Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG:passport-configurator.js: defaultCallback has incorrect params for passport.authenticate #89

Closed
vcwen opened this issue Sep 25, 2015 · 3 comments

Comments

@vcwen
Copy link

vcwen commented Sep 25, 2015

/lib/passport-configurator.js
function: defaultCallback line:423

the third param is a function with params 'req', 'res' which will be called when authentication succeeds, should like below:

app.get('/auth/facebook/callback',
  passport.authenticate('facebook', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

but in defaultCallback:

passport.authenticate(name, _.defaults({session: session},options.authOptions), function(err, user, info) {});

I think the callback 'function(err, user, info)' doesn't really work

@vcwen vcwen changed the title defaultCallback has incorrect params for passport.authenticate BUG:passport-configurator.js: defaultCallback has incorrect params for passport.authenticate Sep 26, 2015
@kevintechie
Copy link
Contributor

The loopback-component-passport module uses the Passport custom callback to handle validation. It does this because not all strategies work with the validation handling built in to Passport. Look at the Passport documentation (scroll down to Custom Callback: http://passportjs.org/docs/authenticate

@vcwen
Copy link
Author

vcwen commented Oct 12, 2015

I see , thank you @kevintechie. And now I know why loopback-component-passport calls req.login(), I was a little confused about this before.

@superkhau
Copy link
Contributor

@wenwei1202 Are you still running into issues? Is this good to close?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants