-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
Description
Hi,
I'm new in swagger. I'm trying to set some jwt security on swagger.json file, so it cant be access on stage env by all users.
I'm using an express server btw.
app.get('/swagger.json', jwt(), function(req, res) {
res.setHeader('Content-Type', 'application/json');
res.send(swaggerSpec);
});
and in my api-docs/index.html I have
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
I end up with "Failed to load spec." error. (it works perfectly when I remove jwt()
I'm using. Swagger-JS 3.0.12