Skip to content

Add authentication middleware to protect API endpoints #5

Description

@AbdulSnk

Overview

The StreamForge API endpoints need to be protected so that only authorized services and users can access contribution and scoring data.

What needs to be done

  • Implement a JWT-based authentication middleware in NestJS
  • Create an auth module under src/
  • Protect all routes except public health check endpoints
  • Implement the following:
    • POST /auth/login — accepts credentials and returns a signed JWT token
    • Auth guard that validates JWT on every protected request
    • Proper error responses for unauthorized requests

Acceptance Criteria

  • src/auth module exists with guard, service, and controller
  • POST /auth/login returns a valid JWT on correct credentials
  • Protected routes return 401 when no token is provided
  • Protected routes return 403 when token is invalid or expired
  • At least one test covers authorized and unauthorized access

Notes

Use the @nestjs/jwt and @nestjs/passport packages. Follow NestJS guard conventions. Do not hardcode secrets — use environment variables.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions