Add ability to extend database session and use in session callback #7150
Labels
enhancement
New feature or request
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Description 📓
Currently, as you can see here, only a subset of the session (from the database) is passed to the session callback.
Pasting here as well:
If I want to extend that session to add additional properties and use them within the session callback, I need to go back to the database with the sessionToken (which is not available within the session call so I end up needing to do a custom initializer to pass it in). It's not very efficient to do the extra database query, and the DX is a pain.
I would love to have the ability to extend which session fields we pass (maybe using a whitelist?), or better yet, we could just pass the session to the callback directly how we get it from the DB, and omit any unnecessary fields (like id for example).
How to reproduce ☕️
N/A
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
The text was updated successfully, but these errors were encountered: