Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Swagger JS Authorise button not being displayed

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);

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!