Passportjs Facebook Login Isauthenticated Returns False Even Though Authentication Succeeds
For some reason on my NodeJS Express app, when authenticating via the PassportJS library with Facebook, regardless of the fact that the authentication succeeds and returns profile
Solution 1:
Try moving the cookieParser
and session
middleware to before the Passport middleware:
app.use(express.cookieParser());
app.use(express.session({ secret: '--- OMMITTED ---' }));
app.use(passport.initialize());
app.use(passport.session());
The reason for this is that Express executes middleware in order of declaration. In your current situation, a request hits the Passport middleware before the cookie/session middleware (on which the Passport middleware relies).
(the same goes for the bodyParser()
middleware by the way, although your routes don't currently rely on it)
Post a Comment for "Passportjs Facebook Login Isauthenticated Returns False Even Though Authentication Succeeds"