I am trying to implement facebook login to my node app using passport JS. I am able to redirect to login page when I entered the get URL related to the request
But after entering my credentials I am unable to get the expected information viz. profile data of my account. Instead I am getting below screen as a response
In addition to that, I am unable to add my localhost URLs to the valid OAuth redirect URIs section
Please look into this and suggest me a fix.
Passport Setup for Facebook.
const { Strategy } = require("passport-facebook");
require("../env-config");
const initializePassportFacebook = passport => {
const {
FACEBOOK_APP_ID: clientID,
FACEBOOK_APP_SECRET: clientSecret
} = process.env;
passport.use(
new Strategy(
{
clientID,
clientSecret,
callbackURL: "http://localhost:3001/user/facebook/callback"
},
(token, tokenSecret, profile, done) => {
return done(null, profile);
}
)
);
};
module.exports = initializePassportFacebook;
User routes(will be preceded http://localhost:3001/user)
userRouter.get("/facebook", passport.authenticate("facebook"));
userRouter.get(
"/facebook/callback",
passport.authenticate("facebook", { failureRedirect }),
(req, res) => {
res.redirect(successRedirect);
}
);


