atinux / nuxt-auth-utils

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

setUserSession specify max age #169

Closed jaketig closed 2 months ago

jaketig commented 2 months ago

Is there any way to pass maxAge when calling setUserSession instead of globally in nuxt.config?

My login endpoint validates user credentails against a pre-existing internal only SSO service. That service is returning the same token/expiration if a user logs in more than once I store that token in my user data with setUserSession and use it to call other services server side later on. I would like to be able to match the expiration of the session with the token expiration.

atinux commented 2 months ago

It's now possible with v0.3.8:

await setUserSession(event, { ... } , {
  maxAge: 60 * 60 * 24 * 7 // 1 week
})