diff --git a/packages/auth/src/app.ts b/packages/auth/src/app.ts index 191cba8120..a70d438e24 100644 --- a/packages/auth/src/app.ts +++ b/packages/auth/src/app.ts @@ -353,18 +353,22 @@ export class App { signed: true, store: { async get(key) { - return await redis.hgetall(key) + const s = await redis.get(key) + + if (!s) return null + + return JSON.parse(s) }, async set(key, session) { // Add a delay to cookie age to ensure redis record expires after cookie - const expireInMs = maxAgeMs + 10 * 1000 + const expireInSec = maxAgeMs / 1000 + 10 const op = redis.multi() - op.hset(key, session) - op.expire(key, expireInMs) + op.set(key, JSON.stringify(session)) + op.expire(key, expireInSec) await op.exec() }, async destroy(key) { - await redis.hdel(key) + await redis.del(key) } } }, @@ -441,17 +445,6 @@ export class App { koa.use(cors()) koa.keys = [this.config.cookieKey] - koa.use( - session( - { - key: 'sessionId', - maxAge: 60 * 1000, - signed: true - }, - koa - ) - ) - koa.use(router.middleware()) koa.use(router.routes()) diff --git a/packages/auth/src/interaction/routes.ts b/packages/auth/src/interaction/routes.ts index 8f29ea9fa5..6eb3f5dcff 100644 --- a/packages/auth/src/interaction/routes.ts +++ b/packages/auth/src/interaction/routes.ts @@ -181,7 +181,6 @@ async function startInteraction( const trx = await Interaction.startTransaction() try { - // TODO: also establish session in redis with short expiry await grantService.markPending(interaction.id, trx) await trx.commit()