HonoHub Logo

HonoHub

Security Definitions

Add security definitions to your OpenAPI specification

You can add security definitions to your OpenAPI specification by using the security property in the openAPIRouteHandler function.

main.get(
  "/openapi.json",
  openAPIRouteHandler(app, {
    documentation: {
      components: {
        securitySchemes: {
          bearerAuth: {
            type: "http",
            scheme: "bearer",
            bearerFormat: "JWT",
          },
        },
      },
      security: [
        {
          bearerAuth: [],
        },
      ],
      servers: [
        {
          url: "http://localhost:3000",
          description: "Local server",
        },
      ],
    },
  })
);

On this page

No Headings
Become a sponsor