Allowing user to update their Name #2422
-
I am using the Email provider for passwordless authentication and for my "newUser" page I bring them to a signup form to allow them to input their name. My current configuration is to make a post request to a custom api route that updates the user's name in a mongodb database using MongoClient. My issue is figuring out how to update this in the session at the same time. If a user logs out and logs back in their name will appear in their account page on the frontend but I can't quite figure out how to update it without have to log out and log back in to a new session. Any feedback would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
My approach in this case usually has been to keep only the Then, I have a |
Beta Was this translation helpful? Give feedback.
My approach in this case usually has been to keep only the
userId
in the session object and nothing else, since that will not change.Then, I have a
/me
endpoint whichtherequires authentication, and that way, any information related to the user can be queried after the user has logged in. I usually store this in a context object which can be accessed anywhere down the component tree.