Skip to content

How to add basic authentication to swagger docs page? #271

Open
@7homasSutter

Description

@7homasSutter

Hi there,

I have tried to find the proper way to add basic authentication to the swagger.io page. However, from the documentation I'm not sure how it is meant to be configured. In the api specification there is a serve_challenge_on_401 field that I set to true and in the official docs I saw that there is a Flask configuration variable HTTP_BASIC_AUTH_REALM without any more information on how to use it.

    api = Api(title=app_instance.config["API_TITLE"],
              version=app_instance.config["API_VERSION"],
              description=app_instance.config["API_DESCRIPTION"],
              prefix=app_instance.config["API_PREFIX"],
              validate=True,
              serve_challenge_on_401=True,
              doc=app_instance.config["API_DOC_FOLDER"])

How can I provide a username and password for the basic authentication? I guess I need to set some specific environment variables but I couldn't find any infos in the docs.

Thx for any help

Tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions