You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there is a preferred way to get the session provider when using database sessions? Specifically I want to check if the user signed in with a specific provider and then pre-fill some fields in a form for them. (I know the info can be passed through a jwt, but I'm not using jwts). It seems to me then I need to make a separate database query within the session callback. As I'm sure next-auth already queries the database for the account information at some point, (even if only at sign-in time) is there a way to intercept and retreive that information, or should I just accept the extra database queries?
Thank you in advance.
How to reproduce ☕️
callbacks: {asyncsession({ session, user }){// We can retrieve all the info from the "user" table easilyconsole.log("User:");console.log(user);/* user: { id: 'xxxxxxxxxxxx...', name: 'Jane Doe', email: 'name@example.com', emailVerified: null, image: 'https://url...' } **/// But the related info from the "account" table isn't available, even at sign-in it seems// Instead we would need to do a separate query here to get that info?returnsession;},};
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description 📓
Hi and thank you for making next-auth,
I was wondering if there is a preferred way to get the session provider when using database sessions? Specifically I want to check if the user signed in with a specific provider and then pre-fill some fields in a form for them. (I know the info can be passed through a jwt, but I'm not using jwts). It seems to me then I need to make a separate database query within the session callback. As I'm sure next-auth already queries the database for the account information at some point, (even if only at sign-in time) is there a way to intercept and retreive that information, or should I just accept the extra database queries?
Thank you in advance.
How to reproduce ☕️
Beta Was this translation helpful? Give feedback.
All reactions