Comments (8)
I'm not planning to implement this now or in current version, especially if we go with #1639. You're probably better off implementing your own session management
What is the connection between user-defined adapters and this issue? Sorry if it's obvious, I'm just getting familiar with this library and trying to make sure I have a good understanding.
Even in the current V4, Lucia's validateSession
is still handling expiration updates.
If the plan is to keep this logic within Lucia, I agree that a config could be useful to give control to the dev. For example, a extensionGracePeriod
config where the expiration is extended if session.expiresAt.getTime() - Date.now() < extensionGracePeriod
from lucia.
To be honest, I just don't like callbacks.
import { SessionState } from "lucia";
const lucia = new Lucia(adapter, {
checkSession: (session) => {
if (Date.now() >= session.expiresAt.getTime()) {
return SessionState.Invalid;
}
return SessionState.UpdateExpiration;
},
})
You probably can update the expiration when retrieving the session too.
UPDATE session SET expires_at = expires_at + 2592000 RETURNING *;
from lucia.
@pilcrowOnPaper
To be honest, I just don't like callbacks.
I guess I wasn't thinking of the API as a callback.
I like the direction that @jshear hinted at above - something declarative like:
const lucia = new Lucia(adapter, {
sessionExpiresIn: new TimeSpan(30, 'd'),
refreshSessionAfter: new TimeSpan(1, 'd'),
}
You could continue to default refreshSessionAfter
to half the time span of the expiry.
And devs could choose to refresh it earlier or later.
(happy to try my hand at a PR for this - if you agree with the direction)
from lucia.
E.g. for our use case I would love to customize this behavior to "refresh the session on every visit" instead of "only refresh the session if user happens visit in second half of their expiry period"
To put it simply, you want a session with no expiration date.
from lucia.
I'm not planning to implement this now or in current version, especially if we go with #1639. You're probably better off implementing your own session management
from lucia.
E.g. for our use case I would love to customize this behavior to "refresh the session on every visit" instead of "only refresh the session if user happens visit in second half of their expiry period"
To put it simply, you want a session with no expiration date.
Not quite - I want a session that expires if the user does not visit at any point in time before the expiry datetime
I'm not planning to implement this now or in current version, especially if we go with #1639. You're probably better off implementing your own session management
Fair. We might try to just build our own little "session refresh" logic for this and use Lucia otherwise. Will update here with result if we do that.
from lucia.
What is the connection between user-defined adapters and this issue?
I'm not talking about adapters here; rather I think you'd be better off ditching Lucia completely and implementing sessions from scratch
from lucia.
What is the connection between user-defined adapters and this issue?
@pilcrowOnPaper
I'm not talking about adapters here; rather I think you'd be better off ditching Lucia completely and implementing sessions from scratch
Seems drastic - would prefer to just configure refresh behavior. Loving Lucia otherwise.
Happy to try my hand at raising a PR for this, but only if you generally agree with the direction of course.
from lucia.
Related Issues (20)
- [Docs]: Add specific guides and examples for Remix HOT 1
- [Feature Request]: Support timestamp mode for Drizzle SQLite expiry column
- [Bug]: ERR_REQUIRE_ESM error in an Express + Typescript project HOT 2
- [Docs]: Include contents on how to test an application with Lucia HOT 1
- [Docs]: SolidStrat middleware does not work on new versions
- Prisma Adapter does not accept Session and User models HOT 3
- RFC: Remove adapter packages HOT 35
- [Bug]: None of the Argon package works for Next.js app HOT 2
- [Bug]: getUserAttributes doesn't include relations field of the user HOT 1
- Global Register types conflicting with each other HOT 1
- [Bug]: Adapter querying all columns, not respecting DatabaseUserAttributes HOT 2
- [Bug]: validateSession returns null. Sveltekit + MongoDB + Lucia HOT 3
- [Docs]: clarify `getUserAttributes()` should mention how it handles the user `id` column HOT 1
- [Feature Request]: Add sequelize ORM support
- lucia auth get data from from different table
- [Bug]: custom sessionId does not work with Drizzle adapter HOT 4
- [Feature Request]: Drizzle pg UUID support on types
- [Bug]: incompatible types with generatedAlwaysAsIdentity
- [Bug]: DrizzleSQLiteAdapter type error breaks build HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lucia.