0

Is there a equivalent of DynamoDB on Azure as a PHP session Handler? I found some very old articles online suggesting to use Azure Table Storage but it doesn't seem to work anymore. (https://dzone.com/articles/handling-php-sessions-windows). Thank you very much!

user2335065
  • 2,337
  • 3
  • 31
  • 54

1 Answers1

0

You can also use Azure table storage for session management. Assuming the table 'sessions' exists, this code works for me (using express-session as middleware):

const session = require('express-session');
const AzureTablesStoreFactory = require('connect-azuretables')(session);

const app = express();

const options = { table: 'sessions', sessionTimeOut: 30}; 
app.use(session({ 
  store: AzureTablesStoreFactory.create(options), 
  secret: process.env.SESSION_SECRET,
  resave: false,
  saveUninitialized: false,
  rolling: true,
  cookie: {maxAge: 600000}
}));

Donald Koscheka
  • 336
  • 1
  • 6