我已经定义了我的 swagger 定义,如下所示:
const swaggerDefinition = {
info: {
title: 'Node Swagger API',
version: '1.0.0',
description: 'Describing a RESTful API with Swagger',
},
host: 'localhost:8000',
basePath: '/',
securityDefinitions: {
JWT: {
type: 'apiKey',
description: 'JWT authorization of an API',
name: 'Authorization',
in: 'header',
},
},
};
Run Code Online (Sandbox Code Playgroud)
但是我无法在 swagger UI 甚至 swagger.json 中获得任何授权
info: {
title: "Node Swagger API",
version: "1.0.0",
description: "Describing a RESTful API with Swagger"
},
host: "localhost:8000",
basePath: "/",
securityDefinitions: { },
swagger: "2.0",
Run Code Online (Sandbox Code Playgroud)
securitydefinitions 块在 swagger.json …