Skip to content

[Python] Generated client uses basic auth when username and password are not set #9430

Closed
@phillip-elliott

Description

@phillip-elliott
Description

I have a spec that allows either use of basic auth or an API-Key header. The generated python client always uses basic auth when making requests even when the username and password are empty (""). The following header is added: Authorization: Basic Og==

Swagger-codegen version

I was using the version on https://editor.swagger.io/

Swagger declaration file content or url

My security definitions are:

"securityDefinitions" : {
    "APIKeyHeader" : {
      "type" : "apiKey",
      "in" : "header",
      "name" : "API-Key"
    },
    "basicAuth" : {
      "type" : "basic"
    }
  }

I am applying these schemes globally:

"security" : [ {
    "APIKeyHeader" : [ ]
  }, {
    "basicAuth" : [ ]
  } ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions