Facebook authentication is not working using passport.js?

I am try to implement facebook auth system but when facebook sends back user data it gives me “This site can’t provide a secure connectionlocalhost sent an invalid response.” response.


Then I try to find out solution of that problem I found my server is run’s on localhost and it had no secure connection. my local machine run on “http” but facebook redirect me on “https” protocol url.

So I go to the my developer console I found my url had secure connection and I don’t know why? I was try to change that but I am fail to change that.

Here is my code:

passport.use(new FacebookStrategy({
    clientID: cradentials.facebookSecrets.FACEBOOK_APP_ID,
    clientSecret: cradentials.facebookSecrets.FACEBOOK_APP_SECRET,
    callbackURL: "/auth/facebook/redirect"
},
    function (accessToken, refreshToken, profile, cb) {
        console.log(profile)
        // User.findOrCreate({ facebookId: profile.id }, function (err, user) {
        //   return cb(err, user);
        // });
    }
));

How do I solve that problem to get my user profile information?

Unfortunately, I do not have a solution for working locally with OAuth.

Whenever, I have worked with anything similar, I have had to transfer my app to CodeSandbox, Repl.it, etc. to run the tests. So, I always tested on a publicly hosted platform. It is not a fix, but it works.

Hope this helps

Google Oauth works perfectly fine but the problem happen is only facebook Oauth.