vvo / iron-session

🛠 Secure, stateless, and cookie-based session library for JavaScript

Home Page:https://get-iron-session.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

session returned from `getIronSessionFromCookieStore` does not implement full interface

brumm opened this issue · comments

Hey there,

We're using Nextjs's cookies() function. The session object returned from getIronSessionFromCookieStore does not include an implementation for updateConfig.

Our use case for updateConfig is to set a maxAge on the session that is not known until after logging in.

We've worked around this for now by allowing the getSession wrapper around getIronSession to pass new sessionOptions

export async function getSession(
  config: Partial<SessionOptions> = sessionOptions,
) {
  const session = getIronSession<SessionData>(
    cookies(),
    merge({}, sessionOptions, config),
  )
  return session
}

Same here - i am using v8.0.1

Fixes in 8.0.2