Allan
BABetter Auth
•Created by Allan on 3/10/2025 in #help
How to store custom data in session?
I was able to add "data" field to session, but I haven't yet found a way how to edit that during the session, for example when user edits the preferred language. Does Better Auth expose session editing methods?
9 replies
BABetter Auth
•Created by Allan on 3/10/2025 in #help
How to store custom data in session?
Thx for the feedback. I hoped to store session data in Redis or other KV-store that does not need persistence. But when I think about it now, then it would also make sense to have additional column "data" as JSON field in sessions table. Is there a way to extend sessions table and ability to store data there, similarly to Laravel's
session()->put()
? Or do I need to handle these inserting to database manually and enriching sessions response using https://www.better-auth.com/docs/concepts/session-management#customizing-session-response?9 replies