scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.41k stars 225 forks source link

my swagger not showing button authorize #304

Closed farasjibran closed 1 year ago

farasjibran commented 2 years ago

i have the problem with this library, i cant show my button authorize

this my options, i using swaggerJsdoc as swagger options, please help

const swaggerSpec = swaggerJsdoc({
  swaggerDefinition: {
    openapi: '3.0.0',
    info: {
      title: 'Relay API IMP STUDIO',
      version: '1.0.0',
    },
    apis: ['./routes/routes.js'],
  },
  components: {
    securitySchemes: {
      bearerAuth: {
        type: 'http',
        scheme: 'bearer',
        bearerFormat: 'JWT'
      }
     }
   },
  security: [{
    bearerAuth: []
  }],
  explorer: true,
  apis: ['./routes/routes.js'],
});
Andrey-Yur commented 1 year ago

I think you should remove {} at you pass swaggerDefinitionobject, so const swaggerSpec = swaggerJsdoc(swaggerDefinition: {...

scottie1984 commented 1 year ago

Does it work when you create a JSON swagger document?

farasjibran commented 1 year ago

my issue is completely done. i close this issue. thank you for your answer guys