How to update session on click (update
doesn't work)
#11019
Unanswered
angelod1as
asked this question in
Help
Replies: 1 comment
-
This is how I fixed the problem.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I started this as an Issue but couldn't reproduce, so it was closed. I decided to ask a question here then.
I'm using NextJS (as seen above) with an integration of Next-Auth and Keycloak.
this is the component code:
As seen above, I have a Checkbox component that's controlled by whatever user.updatedInfo is. Let's suppose it first returns false.
When the user clicks the checkbox, we call an API that updates the user data on the server and it returns 204 if successful.
The order would be:
Right now calling update does not change the user session — not even when I refresh the page after clicking.
I need to totally logout and login to have the updated information.
How to force next-auth to refetch the user from the server entirely?
Beta Was this translation helpful? Give feedback.
All reactions