how to custom session field and user field? (CredentialsProvider) [ts language]
See original GitHub issueDescribe the feature
Hi, iām read doc & try set custom session field and user field
i want set some field in user
{
accessToken: 'dddddddLZ_pCi1bLqdac3sdfdsfdsfdsfdsf6Jxlw0VyVCzHDopjXuYAviolnA',
accessTokenExpiresIn: 604800,
refreshToken: '7c43400b-xxxx-xxxx-xxxx-99b0f91bd570',
user: {
id: '7c43400b-xxxx-xxxx-xxxx-99b0f91bd570',
createdAt: '2021-05-19T17:24:50.579279+07:00',
displayName: 'test',
avatarUrl: 'https://s.gravatar.com/avatar/ac44930a62044d038e16f027629b9206?r=g&default=blank',
locale: 'en',
email: 'example@gmail.com',
isAnonymous: false,
defaultRole: 'admin',
metadata: { permissions: ['xx'] },
emailVerified: true,
phoneNumber: null,
phoneNumberVerified: false,
activeMfaType: null,
roles: [ 'me', 'user' ]
}
}
Additional information
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Using Custom Session Fields - Cvent Community
From the left-hand navigation, under General, click Custom Fields. Select Custom Session Fields from the dropdown. 2 Add the custom session field. Click...
Read more >Issues Ā· sidebase/nuxt-auth - GitHub
how to custom session field and user field ? (CredentialsProvider) [ts language] question Further information is requested.
Read more >How to update custom fields for completed training in user's ...
We encountered a problem regarding updating a custom field for a completed session at users' transcripts level.
Read more >custom session next js next-auth - Stack Overflow
... field to session.user. I created /types/next-auth.d.ts import NextAuth from "next-auth"; declare module "next-auth" { interface Session ...
Read more >Creating user custom fields - Security Center 5.10
Click the Custom fields page, and click Add an item . From the Entity type drop-down list in the Add custom field dialog...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh damn - yeah, thatās unfortunate. Weāll look into this and improve it! Iāve opened #112 to work on this.
And I will close this issue now, as the original author does not respond anymore. Letās continue discussion on the typing in #112
Oh I see, my bad. I read ātsā and misunderstood the question š So, to extend the session with
accessTokenfor example, you must addjwtandsessioncallbacks. And to define the user object, addprofilecallback to you provider. Something like this:Note: This is not a complete example. To implement refresh token you shoud read https://next-auth.js.org/tutorials/refresh-token-rotation, and to improve type interfaces follow the link of my comment above.
Iām new to next-auth and this is what I tested with KeycloakProvider, but I believe it will work for CredentialsProvider too.