Ensure trigger is set in JWT callback when update() is called#12919
Open
mbdevntc wants to merge 1 commit intonextauthjs:mainfrom
Open
Ensure trigger is set in JWT callback when update() is called#12919mbdevntc wants to merge 1 commit intonextauthjs:mainfrom
mbdevntc wants to merge 1 commit intonextauthjs:mainfrom
Conversation
This PR ensures that a POST request is properly sent by defining the body property when needed. Without setting the body, a GET request would be made, preventing the trigger property from being set in the JWT callback. This is important when session data updates are handled inside the JWT callback and rely on the trigger value to determine whether user data should be re-fetched.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
@mbdevntc is attempting to deploy a commit to the authjs Team on Vercel. A member of the Team first needs to authorize it. |
|
Would really love to see this merged. It's affecting our team today |
|
I applied this exact patch in my 5.0.0-beta.29 repo, and it worked for me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
☕️ Reasoning
When update() from the useSession() hook is called without any parameters, a GET request is sent (making its behavior similar to getSession()), instead of a POST request.
This prevents the trigger property (in JWT callback) from being set and used to determine whether the user session data needs to be re-fetched.
This is important when session data updates are handled inside the JWT callback and rely on the trigger value to determine whether user data should be re-fetched.