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

160
Views
express basic auth challenge argument not forcing popup on browser

i am trying to lock up my swagger documentation, i am using express basic auth for this, when i try to access the documentation endpoint it just throws a HTTP ERROR 401 without asking me to provide a username and password.

app.use("/api-docs",basicAuth({
    challenge: true,
    users: { 'me': 'openforme' }  }),
   swaggerUi.serve,
   swaggerUi.setup(yaml.parse(swaggerfile))
);

when i remove the basicauth middleware i can access the endpoint, what i want is a popup to into the username and password.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

use the Nub-auth package

const express = require('express');
const nubAuth = require('nub-auth');
app = express();

app.use(['/v1'], nubAuth({
    challenge: true,
    users: { 'admins': 'admin', 'users': 'user', 'guest': 'guested' }
}));


app.get('/api', (req, res) => {
    res.send('Hello World welcome to API endpoints free !');
});

app.get("/v1", (req, res) => {
  res.send("Hello World welcome to API endpoints closed !");
});

 

from my investigation edge does not have the basic auth feature enabled.

about 4 years ago · Juan Pablo Isaza Report
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!