My Authorise button is not being displayed in swagger ui so I can't add JWT for given request
I have already added the required files added components in which security schemes has been passed but still authorise button
I want to test api with swager but don't have a place to pass JWT token.
Swagger in utils
const express = require("express");
const { type } = require("express/lib/response");
const app = express();
const swaggerJsDoc = require("swagger-jsdoc");
const swaggerOptions = {
definition: {
openapi: "3.0.1",
info: {
title: "APIs",
version: "1.0.0",
},
servers: [
{
url: `http://localhost:5000`
}
],
component:{
securitySchemes: {
bearerAuth: {
type: "http",
name: 'Authorization',
scheme: "bearer"
},
}
}
},
apis: ["./routes/*.js"],
};
const swaggerDocs = swaggerJsDoc(swaggerOptions);
module.exports = { swaggerDocs };
server.js
app.use("/api-docs",swaggerUi.serve,swaggerUi.setup(swaggerDocs));
Route
/**
* @swagger
* /api/user/update:
* put:
* requestBody:
* description: Random
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* email:
* type: string
* password:
* type: string
*
*
* description: Used to register
* security:
* -bearer: []
* responses:
* '201':
* description: A succesfull response
*/
router.put("/update", auth, UserController.updateUser);