Skip to content

HTTP Basic Auth doesn't work in v2.1.0-M2 #1171

Closed
@r-brown

Description

@r-brown

Hello,

I'm trying to configure Swagger to use default demo account with HTTP Basic Auth.

Below is my index.html configuration:

...
            function addAuthorization() {
                var username = $('#input_username').val();
                var password = $('#input_password').val();
                if (username && username.trim() != "" && password && password.trim() != "") {
                    var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password);
                    window.swaggerUi.api.clientAuthorizations.add("basicAuth", basicAuth);
                }
            }
...

source: https://github.com/Labs64/NetLicensing-API/blob/gh-pages/index.html

... and JSON definition:

...
                "security": [
                    {
                        "basicAuth": []
                    }
                ]
...
    "securityDefinitions": {
        "basicAuth": {
            "type": "basic",
            "description": "HTTP Basic Authentication. Works over `HTTP` and `HTTPS`"
        }
    },
...

source: https://github.com/Labs64/NetLicensing-API/blob/gh-pages/v2.0/netlicensing.json

With this configuration basicAuth header is not set and I'm always getting browser prompt dialog for credentials entry.
Could you help me with this issue?

Live version can be found here: http://io.labs64.com/NetLicensing-API/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions