Swagger-ui + oauth -> index.js:24 Uncaught TypeError: Cannot read property 'api' of undefined
<p>first of all i am using a bit modified version of the standard html/js code offered from swagger-ui.</p>

<p>Changes are rather simple, instead of using only a single SwaggerUI element like:</p>

<pre><code>window.swaggerUi = new SwaggerUi({
    ....

window.swaggerUi.load();
</code></pre>

<p>we  iterate over them and create lots of swaggerUI elements:</p>

<pre><code>function addSwaggerUI(url, dom_id, host){
        window[dom_id] = new SwaggerUi({
        ....

window[domId].load();
</code></pre>

<p>this is our iteration:</p>

<pre><code>var services = [{SERVICE_SPECS}];
  var doc_container = document.getElementById('service-doc-container');
  var index = 0;
  services.forEach(function(serviceSpec) {
    var swaggerNode = document.createElement('div');
    swaggerNode.id = "swagger-ui-container-" + index;
    swaggerNode.className = "swagger-ui-wrap";

    var messageNode = document.createElement('div');
    messageNode.id = "message-bar-" + index;
    messageNode.className = "swagger-ui-wrap";

    doc_container.appendChild(swaggerNode);
    doc_container.appendChild(messageNode);
    log("adding service documentation for " + serviceSpec);
    addServiceDocumentation(serviceSpec, swaggerNode.id, "{SERVICE_HOST}");
    index++;
  });
</code></pre>

<p>This worked quiet well until we started using securityDefinitions oAuth:</p>

<pre><code>"securityDefinitions": {
    "OauthSecurity": {
        "type": "oauth2",
        "authorizationUrl": "http://localhost/oauth/dialog",
        "flow": "implicit",
        "scopes":{  
            "write:sessions":"kill sessions",
            "read:sessions":"get sessions"
        }
    }
</code></pre>

<p>Now i get on each swaggerUI this error:</p>

<pre><code>index.js:24 Uncaught TypeError: Cannot read property 'api' of undefined
</code></pre>

<p>Original swaggercode:<a href="https://github.com/swagger-api/swagger-ui/tree/master/dist" rel="nofollow">https://github.com/swagger-api/swagger-ui/tree/master/dist</a> see index.html</p>

<p>Can someone help to fix this?<br>
(Alternative solution: Anyone know of another way to add multiple web apis from different json files on one html page? )</p>

<p><b>UPDATE:</b>
So i looked at the generated page from swagger.petstore.io and found something called 'authorzie-wrapper'it is possible that this element is missing at my code.</p>