atinux / nuxt-auth-utils

Add Authentication to Nuxt applications with secured & sealed cookies sessions.
MIT License
976 stars 91 forks source link

Configure session expiration? #73

Closed MrMarble closed 7 months ago

MrMarble commented 7 months ago

The cookie created with setUserSession is configured to expire with the browser session. How do I persist the cookie for a longer time?

atinux commented 7 months ago

Updated the readme to explain how to: https://github.com/Atinux/nuxt-auth-utils?tab=readme-ov-file#configuration

Basically like this:

export default defineNuxtConfig({
  modules: ['nuxt-auth-utils'],
  runtimeConfig: {
    session: {
      maxAge: 60 * 60 * 24 * 7 // 1 week
    }
  }
})