Skip to content

[Authentication] Handle 401 responses safely by clearing auth token and navigating without forced page reload #47

@mohdsubhan1756

Description

@mohdsubhan1756

axiosInstance redirects users to / on every 401 Unauthorized response using window.location.href. The stored auth token is not cleared before redirecting, which can leave invalid credentials in localStorage and repeatedly trigger unauthorized requests after reload.

Using window.location.href also forces a full page reload instead of SPA navigation, causing poor UX and possible redirect loops.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions