useSession query behaviour?
I have a couple of extra fields on my user table that I like to have when I call useSession, but currently it seems to only include the base "id", "name", "email", "emailVerified", "image"
however when I turn the logger on in drizzle it seems like when get-session endpoint get's called it actually queries all the data from the table.
I guess my question is, since the data is already queried how can i pass it so it's available in my useSession hook.

14 Replies
also looked into customSession but you end up doing another query
https://www.better-auth.com/docs/reference/options
Have you tried the additionalFields in the betterAuth config ?
Options | Better Auth
Better Auth configuration options reference.
I use them myself, but didn't test whether useSession returns them, I didn't need them for that sake
just gave the additionalFields a go, thanks for sharing
but yeah it doesnt seem to return any extra fields
sadge
actually nevermind! it did end up woking belss
bless
Love to hear it :D
for anyone wondering
This library is lowkey really awesome, but sometimes you really need to dig through the docs at points you would not expect initially :D
make sure there is no missmatch between your schema name and fieldName

this works
yeah I've been looking through the source code a lot in the past 2 days or so, lots of goodies built into it
Btw you can set this as "Solved" so people can more easily find it
oh my apologies!