Forum Discussion
Kbm99
New Contributor
Thank you for replying RonRatovsky
I would like to point the UI to the generated definition at runtime but i get a "Failed to Load spec". This may be because to access the definition, there must be some authentication and custom header added. I am using a url like this on index.html
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "https://localhost:8443/example.swagger.io/api/v1/swagger.json?Platform-TenantId=default&&Authorization=Basic bWlmb3M6cGFzc3dvcmQ=",
dom_id: '#swagger-ui',
validatorUrl : false,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
Also the try it out buttons on the swagger ui do not function when i use the path url to the locally saved swagger spec. I think it may be due to the authentication and header to be added on every request inorder to access to the server. How can i resolve this please?
RonRatovsky
6 years agoStaff
This is most likely a CORS issue - please refer to https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/cors.md.
Related Content
- 2 years ago
Recent Discussions
- 4 days ago
- 4 days ago
- 14 days ago
- 31 days ago