Skip to content

[BUG] @auth doesn't attach OpenAPI security requirement, docs UI never sends the key #90

Open

Description

@DeepanshKhurana

Description

When you protect an endpoint with #* @auth <guard_name>, the API access works correctly, but the Try It Out or Authorise in the docs, no matter what flavour you use, fails. The key is never sent, and every endpoint sends a 400 Bad Request, causing confusion.

To Reproduce

  1. Create a plumber2 API with an @authGuard and an endpoint tagged @auth <guard_name>
  2. Start the API and open the docs page (e.g. /__docs__/)
  3. Click "Authorise", enter a valid key
  4. Click "Try it out" on the protected endpoint
  5. Request fails with 400

Another way to check this is to check openapi.json directly: components.securitySchemes has the guard listed correctly, but the operation itself (e.g. paths./health.get) has no security field at all.

Expected Behaviour

The protected endpoint's OpenAPI operation should include a security requirement referencing the guard, so docs UIs know to attach the key automatically.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions