0

I am using firebase hosting to host my dynamic website. I used facebook-passport to authenticate via Facebook however the FacebookStrategy callback error:

Error:

{
  "name":"InternalOAuthError",
  "message":"Failed to obtain access token",
  "oauthError":{
    "errno":"EAI_AGAIN", 
    "code":"EAI_AGAIN",
    "syscall":"getaddrinfo",
    "hostname":"graph.facebook.com",
    "host":"graph.facebook.com",
    "port":443
  }
}

MY ROUTE:

app.get('/sign-in/facebook', passport.authenticate('facebook', { scope:['email'] }));
    app.get('/sign-in/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/sign-in', failureFlash: true }),
       (req, res) => {
            res.redirect('../../user/account');
        },
         err,req,res,next)=>{
            res.send(err);
            res.end();
        }
    );

MY PASSPORT:

    passport.use(new FacebookStrategy({
        clientID: config.FACEBOOK.clientID,
        clientSecret: config.FACEBOOK.clientSecret,
        callbackURL: config.host_name+"/sign-in/facebook/callback", //config.host_name+
        profileFields: ['id', 'displayName', 'picture.type(large)', 'emails'],
        enableProof: true,
        },
        function(accessToken, refreshToken, profile, done) {
            process.nextTick(function () {
                AuthorService.loginWithGoogleSrv(profile, (err, user)=>{
                    return done(err, user);
                })
            });
        }
    ));

What could be the issue here. App is live. Thank you!

KristofMols
  • 3,487
  • 2
  • 38
  • 48
  • Did you configure your app settings accordingly, especially regarding the Valid OAuth Redirect URIs? – CBroe Feb 28 '20 at 09:19
  • Yes, I setup in facebook app -> Products -> Facebook login -> settings -> Valid OAuth Redirect URIs – codedao Feb 28 '20 at 09:46

0 Answers0