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

Req is null, Res has data #103

Open
AustinGS464 opened this issue Jul 4, 2021 · 1 comment
Open

Req is null, Res has data #103

AustinGS464 opened this issue Jul 4, 2021 · 1 comment

Comments

@AustinGS464
Copy link

AustinGS464 commented Jul 4, 2021

Hi all, been running into a weird issue I'm hoping someone else has seen.

I have the following code for my strategy

passport.use(
  new FacebookTokenStrategy(
    {
      clientID: config.facebookAuth.clientID,
      clientSecret: config.facebookAuth.clientSecret
    },
    function (accessToken, refreshToken, profile, done) {
      let user = {
        email: profile.emails[0].value,
        name: profile.name.givenName + " " + profile.name.familyName,
        id: profile.id,
        token: accessToken,
      };
      return done(null, user);
    }
  )
);

And the following for my route

router.post(
  "/auth/facebook/token",
  passport.authenticate("facebook-token", function (req, res) {
    console.log("REQ: " + req);
    console.log("RES: " + res);
    if (req.user) {
      console.log(req.user);
    }
  })
);

However The req ends up being null, getting a TypeError for req.user, and the res only is an object, the same one defined in my Strategy. I can't even call any standard res methods like send

@ghaiklor
Copy link
Collaborator

ghaiklor commented Jul 5, 2021

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