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.
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.