Skip to content

[Security] Implement Persistent JWT Authentication with Access/Refresh Tokens and RBAC #1110

@SatyamPandey-07

Description

@SatyamPandey-07

Description
The application currently lack a persistent session management system. Users need to stay logged in without sending passwords on every request, and we need to differentiate between Farmer and Shopkeeper roles.

Proposed Solution
I propose implementing a professional JWT authentication layer:

  1. Create login endpoint that issues both an Access Token and a Refresh Token.
  2. Store Refresh Tokens in secure, HttpOnly cookies to prevent XSS.
  3. Implement a /refresh endpoint to rotate access tokens.
  4. Create @token_required and @roles_required('admin') decorators for route protection.
  5. Integrate with the existing Bcrypt-hashed password system.

Impact

  • Enables secure, long-term user sessions.
  • Foundation for personalized farmer dashboards.
  • Prevents unauthorized access to sensitive financial data.

I am ready to implement this industry-standard security flow. Please assign this to me.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions