const session = require('express-session');
const DynamoDBStore = require('connect-dynamodb')(session);
const { setupKinde, GrantType } = require('@kinde-oss/kinde-node-express');
...
const app = express();
...
store = new DynamoDBStore({
table: process.env.SESSIONS_DYNAMODB_TABLE_NAME,
client: dynamoDbUtils.dynamoClient,
});
app.use(session({
store,
secret: process.env.SESSION_SECRET,
saveUninitialized: false,
cookie: {
sameSite: 'lax', // Allow cookies in top-level navigations
httpOnly: true, // If true, session cookie is not accessible by JavaScript (for security)
secure: process.env.ENVIRONMENT === 'production', // Set to true only in production (HTTPS)
path: '/',
},
resave: false,
}));
...
if (!kindeClient) {
kindeClient = setupKinde(kindeConfig, app);
}
...
const session = require('express-session');
const DynamoDBStore = require('connect-dynamodb')(session);
const { setupKinde, GrantType } = require('@kinde-oss/kinde-node-express');
...
const app = express();
...
store = new DynamoDBStore({
table: process.env.SESSIONS_DYNAMODB_TABLE_NAME,
client: dynamoDbUtils.dynamoClient,
});
app.use(session({
store,
secret: process.env.SESSION_SECRET,
saveUninitialized: false,
cookie: {
sameSite: 'lax', // Allow cookies in top-level navigations
httpOnly: true, // If true, session cookie is not accessible by JavaScript (for security)
secure: process.env.ENVIRONMENT === 'production', // Set to true only in production (HTTPS)
path: '/',
},
resave: false,
}));
...
if (!kindeClient) {
kindeClient = setupKinde(kindeConfig, app);
}
...