我试图简单地将 Twitter OAuth 用于我的网络应用程序。那是我的 index.js 文件:
const express = require("express");
const passport = require("passport");
const session = require("express-session");
require("./services/passport");
const app = express();
require("./routes/authRoutes")(app);
app.use(
session({
secret: "keyboard cat",
resave: false,
saveUninitialized: true
})
);
app.use(passport.initialize());
app.use(passport.session());
app.listen(5000);
现在即使我实现了会话,我仍然得到需要会话支持的错误:
Error: OAuth authentication requires session support. Did you forget to use express-session middleware?
我经历了十几个 github 问题和 stackoverflow 问题,但找不到正确的答案。希望你能帮我