Search code examples
node.jsexpresspassport-facebook

passport-facebook Failed to obtain access token


I am trying to register my users with Facebook using [email protected] following this example. My problem is that when the user is authenticated the response is:

Failed to obtain access token

Error: getaddrinfo ENOTFOUND at Strategy.OAuth2Strategy._createOAuthError /home/sigfried/github/passport-social/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:348:17)

I've checked my Express routes and everything seems to be fine. I checked the Network methods with Firefox and when the response come back to my server I've noticed an 500 Internal Server Error with this address: http://localhost:3000/login/facebook/callback?code=L4rg3H4sh#_=_


Solution

  • Most likely I was trying to access an address in my localhost, so I think that the solution here would be to expose, with something like ngrok, my local server and then problem solved.

    Hope this helps someone in a hurry or as naive as I was.