How to modify useSession data type?

I am using credentials and providers then returning user, I was trying to put some user infos into session but session.user always returning
{
user: {
name: '1234',
email: 'c@b.com',
image: null,
id: 'clb87p1tw0000vxqsb4kij8qw'
},
expires: '2022-12-03T18:21:49.726Z'
}
{
user: {
name: '1234',
email: 'c@b.com',
image: null,
id: 'clb87p1tw0000vxqsb4kij8qw'
},
expires: '2022-12-03T18:21:49.726Z'
}
37 Replies
cje
cje2y ago
id is a field that create-t3-app adds to the session. look in [nextauth].ts and next-auth.d.ts to see how we do it, you can do the same for any other data that being said be careful with this - only send stuff to the frontend that you're ok with the user seeing
Çağlar
Çağlar2y ago
I did a lot of changing on that type file Nothing happened 😄
Çağlar
Çağlar2y ago
Çağlar
Çağlar2y ago
it should return only id right?
Çağlar
Çağlar2y ago
It is returning the same type of object
Çağlar
Çağlar2y ago
this is where I log
cje
cje2y ago
the interface doesn't determine what is returned it's just a typedef types don't exist at runtime
Çağlar
Çağlar2y ago
Yes exactly I couldnt find where I modify returnin object
cje
cje2y ago
you already posted it 😉 the session callback
Çağlar
Çağlar2y ago
That made me confuse 😄
cje
cje2y ago
cje
cje2y ago
theres probably a nicer way to write it but this works
cje
cje2y ago
Çağlar
Çağlar2y ago
I am wondering
cje
cje2y ago
"Logged in as" doesn't show a name because it's not being passed anymore
Want results from more Discord servers?
Add your server