Adding Authorization Bearer to header on swagger

Viewed 187

I'm trying to use swagger ui but i can't authenticate on swagger ui.

server.js

    const swaggerDefinition = JSON.parse(fs.readFileSync( "./swagger.json" ));
    
    const swaggerOptions = swaggerDefinition;
    
    const swaggerDocs = swaggerJsDoc(swaggerOptions);
    
    app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocs));

swagger.json



"host": "localhost:5000",
    "basePath": "/api",
    "schemes": [
      "http"
    ],
    "securityDefinitions": {
      "Bearer" : {
        "type": "access_token",
        "name": "Authorization",
        "in": "header"
      }
    }

I'm using like this on POSTMAN (Its works)

POSTMAN Headers Here

0 Answers
Related