Forum Discussion

KlingerKlinger's avatar
KlingerKlinger
Occasional Visitor
12 months ago

Basicauth or authentication by username and password

 

I use Swagger and flask in python and generate a SwaggerUI page for it. I would like to save my API by authentication with username and password. I have read throw all documentation but I do not understand: Where do I actually set the username and password?

I copied this into my yaml file:

components:
  securitySchemes:
    klingerAuth:
      type: http
      scheme: basic
security:
  - klingerAuth: []

This then adds lock-symbols to everything and adds an authorize button. But one can anyway access everything and the authorise button accepts everything as input for username and password.

So where to I actually define what could be accepted there?

 

Swagger is defined like this in my programme:

app = Flask(__name__)
api = Api(app)
SWAGGER_URL = "/pathapi"
API_URL = "/pathapi/swagger.yaml"
swaggerui_blueprint = get_swaggerui_blueprint(
    SWAGGER_URL,
    API_URL,
    config={
        "app_name": "secret AI stuff"
    }
)
app.register_blueprint(swaggerui_blueprint, url_prefix=SWAGGER_URL)

Maybe I just dont understand the process and I need to define the entire login process by my own? If so, I find it hard to read that information from the actual documentation.

 

Thanks in advance for anybody helping 🙂

No RepliesBe the first to reply