Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load spec. when trying to get swagger.json. #3157

Closed
martinpagesaal opened this issue May 31, 2017 · 1 comment
Closed

Failed to load spec. when trying to get swagger.json. #3157

martinpagesaal opened this issue May 31, 2017 · 1 comment

Comments

@martinpagesaal
Copy link

martinpagesaal commented May 31, 2017

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

@webron
Copy link
Contributor

webron commented May 31, 2017

Can't quite do that yet. We're working on a solution though. Please follow #2793.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants