我的会话对象上不存在护照对象。它在我的本地环境中按预期工作,但是当我在aws上移动到我的生产服务器时,没有护照对象。会话成功存储在我的dynamoDB存储中,但它没有显示在请求中。
这是我对req.session对象的期望(以及我在本地env中得到的内容):
session:
Session {
cookie:
{ path: '/',
_expires: null,
originalMaxAge: null,
httpOnly: true },
passport: { user: [Object] } } <------- This Object
以下是我正在制作中的内容:
session:
Session {
cookie:
{ path: '/',
_expires: null,
originalMaxAge: null,
httpOnly: true,
secure: false } }
---------No sign of the passport object---------
服务器设置:
// DynamoDBStore Configuration
const options = {
table: 'capture-sessions',
AWSConfigJSON: {
accessKeyId: awsConfig.accessKeyId,
secretAccessKey: awsConfig.secretAccessKey,
region: 'us-east-2'
}
};
app.use(cors());
app.use(expressSession({
store: new DynamoDBStore(options),
secret: 'keyboard cat',
saveUninitialized: false,
resave: false,
cookie: {
secure: false,
path: '/',
httpOnly: true
}
}));
app.use(passport.initialize());
app.use(passport.session());
require('./passport/init')(passport);