jaredhanson/passport-facebook

facebook login error : Sorry, something went wrong. We're working on getting this fixed as soon as we can.

akasharya1304 opened this issue · 1 comments

** READ THIS FIRST! **

Are you looking for help?

Reminder: The issue tracker is not a support forum.

Issues should only be filed in this project once they are able to be reproduced
and confirmed as a flaw in the software or incorrect information in associated
documention.

If you are encountering problems integrating this module into your application,
please post a question on the discussion forum
rather than filing an issue.

Is this a security issue?

Do not open issues that might have security implications. Potential security
vulnerabilities should be reported privately to jaredhanson@gmail.com. Once any
vulerabilities have been repaired, the details will be disclosed publicly in a
responsible manner. This also allows time for coordinating with affected parties
in order to mitigate negative consequences.

If neither of the above two scenarios apply to your situation, you should open
an issue. Delete this paragraph and the text above, and fill in the information
requested below.

Expected behavior

Actual behavior

Steps to reproduce

// Format code using Markdown code blocks

Environment

  • Operating System:
  • Node version:
  • passport version:
  • passport-facebook version:

Expected Behaviour

I'm trying to add SignUp with Facebook functionality on my videocalling web application.

But it shows following error whenever i click on the signup with facebook button.

Sorry, something went wrong.
We're working on getting this fixed as soon as we can.

What i have done is shown below.

passport.use(
  new FacebookStrategy(
    {
      clientID: "FacebookAppId",
      clientSecret: "FacebookAppSecret",
      callbackURL: "http://localhost:3000/auth/facebook/callback",
      profileFields: ["id", "displayName", "email"],
      enableProof: true,
    },
    async (accessToken, refreshToken, profile, cb) => {
      try {
        const user = await User.findOne({ facebookId: profile.id });
        if (!user) return cb(null, false, { message: "user not found" });
        if (user) {
          return cb(null, user);
        } else {
          const user = await User.findOne({ email: profile.emails[0].value });
          if (user) {
            user.facebookId = profile.id;
            return await user.save();
          }
          const newuser = new User.create({
            name: profile.displayName,
            email: profile.emails[0].value,
            facebookId: profile.id,
          });

          if (!newuser)
            return cb(null, false, {
              message: "error while creating new user",
            });
        }
      } catch (error) {
        console.error(error);
      }
    }
  )
);

Routes

router.get(
  "/auth/facebook",
  passport.authenticate("facebook", {
    authType: "reauthenticate",
    scope: "email",
  })
);

router.get(
  "/oauth2/redirect/facebook  ",
  passport.authenticate("facebook", {
    successRedirect: "/dashboard",
    failureRedirect: "/login",
  })
);

software versions:

Operating System: Windows 10 Pro
Node version : v18.13.0
passport : ^0.3.2
passport-facebook :^3.0.0