I am trying to authenticate with facebook but getting error TokenError: Malformed auth code

I am trying to authenticate with facebook but getting error TokenError: Malformed auth code

我正在尝试使用 passport.js 对使用 facebook 登录的用户进行身份验证。我能够登录到 facebook 然后出现以下错误

TokenError:授权码格式错误。


app.get('/facebook',passport.authenticate('facebook'));

passport.use(new FacebookStrategy({
    clientID: FACEBOOK_APP_ID,
    clientSecret: FACEBOOK_SECRET_KEY,    
    callbackURL: "facebook/redirect"
  },
  function(accessToken, refreshToken, profile, done) {
    console.log("authenticated");
  }
));

app.get("/facebook/redirect",passport.authenticate("facebook"),function(req,res)
{
    console.log("hey");
});

尝试在重定向 URI 中添加尾部斜杠

passport.use(new FacebookStrategy({
    clientID: FACEBOOK_APP_ID,
    clientSecret: FACEBOOK_SECRET_KEY,    
    callbackURL: "facebook/redirect/"
  },
  function(accessToken, refreshToken, profile, done) {
    console.log("authenticated");
  }
));