Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
akasharya1304 opened this issue Sep 5, 2021 · 1 comment

Comments

@akasharya1304
Copy link

** 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 [email protected]. 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:
@Groot-2001
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants