Skip to content

Ensure trigger is set in JWT callback when update() is called #12919

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mbdevntc
Copy link

☕️ 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.

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.
@mbdevntc mbdevntc requested a review from ThangHuuVu as a code owner April 28, 2025 13:03
Copy link

vercel bot commented Apr 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 1:06pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Apr 28, 2025 1:06pm

Copy link

vercel bot commented Apr 28, 2025

@mbdevntc is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant