v0.13.0: What's new? #155
pilcrowonpaper
announced in
Announcements
Replies: 2 comments 3 replies
-
Also, with this update I'm pretty satisfied with Lucia so unless there's a major change in SvelteKit or I think of something major, there likely won't be a major update for a while. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Thanks for your hard work. ;) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Fixed critical security issue with v0.13.1 - Please use v0.13.1
Hello!
Sorry about the pushing another semi-major update, but had some good feedback so I wanted to implement them immediately.
Major changes
Handle sessions inside hooks
Lucia will now read, validate, and renew sessions inside hooks, handled by
handleHooks()
. Previously it was inside the root layout server load function usinghandleServerSession()
. This means Lucia will automatically validate your requests as well as renew requests using expired sessions.handleServerSession()
will read the session data, fetch the user, and pass that data to your load functions and the client.locals.getSession()
This is the new way of getting the session in the server. No more
validateRequestEvent()
and try catch blocks.transformUserData()
By default, the user object will only have
userId
, regardless of if you have additional columns stored in theuser
table. You can configuretransformUserData()
to transform the raw database data to the user object.Renamed
userData
toattributes
userData
was a vague, confusing name so I'm happy that it's getting a proper name. This means all instance ofuserData
have changed:userData
forcreateUser()
is nowattributes
,updateUserData()
is nowupdateUserAttributes()
, etc. This change also affects adapters.Adapters:
setUser()
returns the created userPreviously it returned the user id of the created user. Should be a quick fix.
Removed
validateRequestEvent()
validateRequest()
has been added back by this does NOT attempt to renew the session.Migration
First, update your adapter to the latest version. Aside from the changes above, the
Lucia
namespace has changed.Export the type of
auth
:And in
app.d.ts
:The path in
import('$lib/server/lucia.js').Auth
is where you exportedauth
(lucia()
), whileUserAttributes
is the oldUserData
.Locals
should configured as well.Changelog
handleHooks()
automatically validates and renew sessionUser
is{ userId: string }
by default - additional data stored inuser
table are no longer automatically addeduserData
fields toattributes
forcreateUser()
updateUserData()
toupdateUserAttributes()
setUser()
adapter method returnsUser
instead of user idLucia.UserData
toLucia.UserAttributes
userData
toattributes
field forupdateUser()
adapter methodLucia.Auth
andLucia.UserAttributes type must be configured for
transformUserData()`validateRequestEvent()
methodsetUser()
adapter method returns createdUser
instead of user idvalidateRequest()
methodtransformUserData()
configEdit: Fixed issue where hooks wasn't validating request origin. I remember fixing this issue but it seems it wasn't saved? Nonetheless, really sorry about this! I'm will be extra careful moving forward but I think this shouldn't be an issue since it was fixed in 5 minutes since release.
Beta Was this translation helpful? Give feedback.
All reactions