fix: Profile Update Triggers Unexpected Logout on Page Refresh (closes #1163)#1418
Open
ObaidBuilds wants to merge 1 commit intoidurar:devfrom
Open
fix: Profile Update Triggers Unexpected Logout on Page Refresh (closes #1163)#1418ObaidBuilds wants to merge 1 commit intoidurar:devfrom
ObaidBuilds wants to merge 1 commit intoidurar:devfrom
Conversation
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.
Description
This pull request fixes an issue where updating the profile and navigating or reloading would log out the user.
The root cause was that the updateProfile API only returned the updated user details and did not include the JWT token. As a result, when the frontend updated the auth object in localStorage, it overwrote the previous data and lost the existing token, causing the user to be logged out on page refresh or navigation.
With this fix, the backend now includes the JWT token in the response whenever the profile is updated. This ensures that the frontend receives both the updated user details and the valid token, and the user remains logged in after updating their profile.
Related Issues
Closes #1163
Steps to Test
Screenshots (if applicable)
Reference video demonstrating the issue before the fix is available in issue #1163 comment.
A short reference video demonstrating the fixed behavior is attached for verification.
fix-issue-1163.webm
Checklist