-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsure how to get data from scopes other than the default ones #614
Comments
You'll need to expand your session using next-auth's callbacks. You can add data to your JWT using the JWT callback: Then to expand the session you can do the same using the session callback: |
I've tried this but to no avail? I've changed the
And changed my
However, in the browser returns the JWT with the original |
Would be nice to have a working example |
This happens because on subsequent invocation (every time session is called), profile is not passed to jwt callback ( user, account, profile, isNewUser is passed only the first time ie. when the signin happens ) jwt: async (token, user, account, profile, isNewUser) => {
if (profile) { token.profile = profile}
return Promise.resolve(token)
} You needn't add the profile method to the Provider options to add them to jwt. |
hmm I'm getting some really strange behavior for users that already have accounts created in the db: when but after the user logs in and gets directed to the landing page, when i check session (in the broswer) sometimes the prop is there, sometimes it is not i.e. as if in a quantum state. anyone running into similiar things? |
Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep ot open. Thanks! |
Hi there! It looks like this issue hasn't had any activity for a while. To keep things tidy, I am going to close this issue for now. If you think your issue is still relevant, just leave a comment and I will reopen it. (Read more at #912) Thanks! |
Guys, the id is called sub as user prop: callbacks: {
session: async (session, user) => {
session.user.id = user.sub
console.log("CALLBACK SESSION", session, user)
return Promise.resolve(session)
}
} this will add ID to the session user object, which is available site-wise. |
Well, how it's possible to fetch user's guilds with it? |
Discord API |
Using the Discord provider I added a
scope
option to include "guilds", I am not sure how I can access the guilds after they have been allowed, below is my attempt, I also tried to just add a new propertyguilds
with the same value outside of the profile propertyThe text was updated successfully, but these errors were encountered: