Skip to content

security: Add simple API key verification for protected routes #36

@AlAfiz

Description

@AlAfiz

Description

Certain backend routes (like triggering manual database syncs in the future) should only be accessible to authorized clients. We need a simple header check.

Requirements

  • Add an ADMIN_API_KEY to the .env file.
  • Create a middleware function verifyApiKey.
  • Check if req.headers['x-api-key'] matches the environment variable.
  • If it doesn't match, return a 401 Unauthorized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions