jaredhanson / passport-facebook

Facebook authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-facebook/?utm_source=github&utm_medium=referral&utm_campaign=passport-facebook&utm_content=about
MIT License
1.29k stars 447 forks source link

parseErrorResponse with undefined clientSecret #210

Open saschb2b opened 7 years ago

saschb2b commented 7 years ago

Got a not really helpful 500 error message

server_1  |   Error
server_1  |       at Strategy.parseErrorResponse (/usr/src/app/node_modules/passport-facebook/lib/strategy.js:196:12)
server_1  |       at Strategy.OAuth2Strategy._createOAuthError (/usr/src/app/node_modules/passport-oauth2/lib/strategy.js:376:16)
server_1  |       at /usr/src/app/node_modules/passport-oauth2/lib/strategy.js:166:45
server_1  |       at /usr/src/app/node_modules/oauth/lib/oauth2.js:191:18
server_1  |       at passBackControl (/usr/src/app/node_modules/oauth/lib/oauth2.js:132:9)
server_1  |       at IncomingMessage.<anonymous> (/usr/src/app/node_modules/oauth/lib/oauth2.js:157:7)
server_1  |       at emitNone (events.js:110:20)
server_1  |       at IncomingMessage.emit (events.js:207:7)
server_1  |       at endReadableNT (_stream_readable.js:1047:12)
server_1  |       at _combinedTickCallback (internal/process/next_tick.js:102:11)
server_1  |       at process._tickDomainCallback (internal/process/next_tick.js:198:9)

Occured due to an undefined clientSecret value. Found it after spending way too much time debugging. Error as a message was not very helpful in this case. You could say that the configuration is wrong and print out the given object. Maybe pointing out which parameter is wrong.

veeramarni commented 6 years ago

Seems to be answered in #100

   router.get('/login/facebook/return',
   (req, res, next) => {
   return passport.authenticate('facebook', {
          failureRedirect: '/login',
          session: false
          },
       (err, user, info) => {
          if(err) {
            logger.error(err);
            res.redirect('/login');
          }
          else
          {
              next();
          }
      })(req, res, next);
  })
codalife commented 6 years ago

Same here with heroku