Skip to content

fix: validate auth token format before attaching to requests#195

Open
ahmedabbas52233-a11y wants to merge 1 commit into
Navin-xmr:mainfrom
ahmedabbas52233-a11y:feature/issue-181-token-validation
Open

fix: validate auth token format before attaching to requests#195
ahmedabbas52233-a11y wants to merge 1 commit into
Navin-xmr:mainfrom
ahmedabbas52233-a11y:feature/issue-181-token-validation

Conversation

@ahmedabbas52233-a11y
Copy link
Copy Markdown

Summary

Closes #181

Adds basic JWT validation to the auth interceptor before attaching tokens to outgoing requests.

Changes

  • Added isValidJWT() helper to validate token structure (3 dot-separated base64url segments)
  • Malformed/corrupted tokens are cleared from localStorage immediately
  • User is redirected to /login when token validation fails
  • Redirect loop prevention when already on /login.

Testing

  • pnpm run lint passes
  • pnpm run build passes
  • pnpm run dev starts without errors

- Add isValidJWT helper to check JWT structure (3 dot-separated segments)
- Clear malformed tokens from localStorage immediately
- Redirect to /login when token validation fails
- Prevent redirect loops when already on /login page

Closes Navin-xmr#181
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.

[Enhancement] Validate auth token format before attaching to requests

1 participant