Skip to content

Conversation

@LONECODER1
Copy link
Contributor

Description

This pull request adds a JWT authentication middleware to secure protected routes and restrict access based on user roles.
The middleware verifies access tokens and checks whether the user’s role (e.g., admin, user, moderator) matches the required role for a given route.

Key Changes

  • Implemented JWT verification using access and refresh tokens.
  • Added role-based access control (RBAC) logic.
  • Updated protected routes to use the new middleware.
  • Improved error responses for unauthorized and invalid token requests.

Semver Changes

  • Minor (new features, no breaking changes)

Issues

Closes #20

Checklist

  • I have read the Contributing Guidelines.
  • Middleware properly restricts routes based on roles.
  • Tokens are validated using environment secrets.
  • All tests and lint checks pass.

@04shubham7
Copy link
Member

04shubham7 commented Oct 21, 2025

Pls resolve merge conflicts first and pls try to do it carefully as whole project depends upon packages

Copy link
Member

@04shubham7 04shubham7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE

@04shubham7 04shubham7 merged commit db8395d into OPCODE-Open-Spring-Fest:main Oct 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add JWT-based authentication middleware to protect APIs

2 participants