Hi,

I've configured Swashbuckle version 5.6 for a Web API project using these 
settings:

 public class SwaggerConfig
    {
        public static void Register()
        {
            if (ConfigUtil.SSOSupported)
            {
                var thisAssembly = typeof(SwaggerConfig).Assembly;

                GlobalConfiguration.Configuration
                    .EnableSwagger(c =>
                        {
                            c.Schemes(new[] { "http", "https" });

                            c.SingleApiVersion("v1", "API Adapter");
                            c.PrettyPrint();

                            c.OAuth2("oauth2")
                                .Description("Description here")
                                .Flow("implicit")
                                .AuthorizationUrl(ConfigUtil.SSOAuthority() 
+ "/connect/authorize")
                                .Scopes(scopes =>
                                {
                                    scopes.Add("api", "API Scope");
                                });

                            c.IgnoreObsoleteProperties();

                            c.DescribeAllEnumsAsStrings();
                        })
                    .EnableSwaggerUi(c =>
                        {
                            c.EnableOAuth2Support("test-client-id", 
"test-realm", "Swagger UI");
                        });
            }
        }
    }

Whilst the UI is loading, it isn't showing the OAuth button to the top 
right of the screen, rather the API Key field is present despite not being 
configured.
I've traced through the client side code, and whilst it isn't erroring, it 
is falling out at the highlighted line:

function initOAuth(e) {
    var o = e || {}
      , i = [];
    return appName = o.appName || i.push("missing appName"),
    popupMask = o.popupMask || $("#api-common-mask"),
    popupDialog = o.popupDialog || $(".api-popup-dialog"),
    clientId = o.clientId || i.push("missing client id"),
    clientSecret = o.clientSecret || null,
    realm = o.realm || i.push("missing realm"),
    scopeSeparator = o.scopeSeparator || " ",
    additionalQueryStringParams = o.additionalQueryStringParams || {},
    i.length > 0 ? void log("auth unable initialize oauth: " + i) : ($("pre 
code").each(function(e, o) {
        hljs.highlightBlock(o)
    }),
    $(".api-ic").unbind(),
    void $(".api-ic").click(function(e) {
        $(e.target).hasClass("ic-off") ? handleLogin() : handleLogout()
    }))
}

Has anyone seen this before?
>From the articles I've found in this area there were some suggestions of 
other versions, so i've tried moving back to v5.1.2 and 5.0.0, but the same 
issue occurs.

Any help much appreciated as I've been looking at the same thing for a 
while now!

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to