chanfana
chanfana copied to clipboard
Security not applying to the securitySchemes or schema
I have added an api key to my router so that when you go to docs a new authorise button appears, however when you try to make a request, it does not apply the API key you specify into the headers as expected, how do I fix this? I want to be able to have the docs show the same security etc as the main API.
export const router = OpenAPIRouter({
docs_url: "/",
schema: {
info: {
title: "JCoNet LTD API",
version: "1",
},
},
});
router.registry.registerComponent("securitySchemes", "api_key", {
type: "apiKey",
in: "header",
name: "x-api-key",
});
As you can see in the code the scheme is shown but is not being included in the docs examples so isn't applying the header, have I done something wrong or does the docs not display the headers you provide in authorise?