Skip to content

Comments

fix: Profile Update Triggers Unexpected Logout on Page Refresh (closes #1163)#1418

Open
ObaidBuilds wants to merge 1 commit intoidurar:devfrom
ObaidBuilds:issues/fix-preserve-token
Open

fix: Profile Update Triggers Unexpected Logout on Page Refresh (closes #1163)#1418
ObaidBuilds wants to merge 1 commit intoidurar:devfrom
ObaidBuilds:issues/fix-preserve-token

Conversation

@ObaidBuilds
Copy link

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

  • Log in to the application
  • Navigate to the Profile page
  • Update profile details
  • Save changes
  • Refresh the page or navigate to another route
  • Verify the user remains authenticated

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

  • I have tested these changes
  • I have updated the relevant documentation
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the codebase
  • My changes generate no new warnings or errors
  • The title of my pull request is clear and descriptive

@ObaidBuilds ObaidBuilds changed the title fix: preserve JWT token on profile update fix(issues/1163): Profile Update Triggers Unexpected Logout on Page Refresh Jan 26, 2026
@ObaidBuilds ObaidBuilds changed the title fix(issues/1163): Profile Update Triggers Unexpected Logout on Page Refresh fix: Profile Update Triggers Unexpected Logout on Page Refresh Jan 26, 2026
@ObaidBuilds ObaidBuilds changed the title fix: Profile Update Triggers Unexpected Logout on Page Refresh fix: Profile Update Triggers Unexpected Logout on Page Refresh (closes #1163) Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant