You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm having some trouble getting something to work. i'm using a token strategy not sessions and i'm trying to have one handler for both authentication and authorization (just like at the end of the Authorize example in the docs http://passportjs.org/guide/authorize/)
i have some middleware that is called before the call to passport authenticate like so:
the purpose of that middleware is to add user to the req object, so that i can check for it in passport just like the example suggests. in my passport file i have the following at the beginning:
var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;
exports.setup = function (User, config) {
passport.use(new FacebookStrategy(config.facebook,
function(req, accessToken, refreshToken, profile, done) {
console.log(req.user);
process.nextTick(function() {
if (!req.user) {
User.findOne({'strategies.facebook.id': profile.id}, function(err,user){
my config has the proper passReqToCallback setting (true) to make this supposedly happen correctly. however, any modifications i make to the request object before calling passport in the route get completely ignored.
please let me know if i'm doing something totally stupid or if this is a bug. thanks!
The text was updated successfully, but these errors were encountered:
UPDATE:
for anyone having this issue and possibly, like me, using the yeoman fullstack generator, i was (stupidly) putting the middleware call in the wrong route. here is the working solution:
hi there. thanks for this awesome library.
i'm having some trouble getting something to work. i'm using a token strategy not sessions and i'm trying to have one handler for both authentication and authorization (just like at the end of the Authorize example in the docs http://passportjs.org/guide/authorize/)
i have some middleware that is called before the call to passport authenticate like so:
the purpose of that middleware is to add user to the req object, so that i can check for it in passport just like the example suggests. in my passport file i have the following at the beginning:
my config has the proper passReqToCallback setting (true) to make this supposedly happen correctly. however, any modifications i make to the request object before calling passport in the route get completely ignored.
please let me know if i'm doing something totally stupid or if this is a bug. thanks!
The text was updated successfully, but these errors were encountered: