Skip to content

As a dev, I want to migrate backend authentication from Basic Auth to JWT #163

@k-allagbe

Description

@k-allagbe

Description

Context
The backend currently uses Basic Auth for authentication, which is outdated and doesn't meet modern standards. We need to replace Basic Auth with JWT (JSON Web Tokens) to provide a more appropriate and standardized authentication system for our REST API.

Problem Statement
Basic Auth is no longer suitable for handling user authentication in a REST-based system. We want to transition to JWT to ensure a more modern and secure method for managing user sessions and authentication. This migration should fully replace Basic Auth with JWT.

Acceptance Criteria

  • Modify the existing login endpoint to issue JWTs instead of relying on Basic Auth headers.
  • Implement middleware to validate JWTs for all protected API routes.
  • Ensure that protected routes require a valid JWT in the Authorization header (Bearer token).
  • Implement token expiration handling, ensuring that expired tokens return a 401 Unauthorized response.
  • Add support for token refreshing, allowing users to request a new token without needing to log in again.
  • Remove Basic Auth from all existing routes and replace it with JWT-based authentication.
  • Ensure that error handling for invalid or missing JWTs returns appropriate HTTP responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Paused

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions