Basic authentication not working with file provider

I want to add basic authentication to the dashboard and tried using the examples from the docs. But unable to get it working, in fact, the dashboard is not at all showing up. Please help me.

config.toml

[api]
    debug = true
    dashboard = true
[log]
    level = "DEBUG"

[providers]
    [providers.file]
        directory = "dyn/"
        watch = true

dyn/config.toml

[http.routers.api]
  rule = "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
  service = "api@internal"
  middlewares = ["auth"]

[http.middlewares.auth.basicAuth]
  users = [
    "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
    "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0",
  ]

@ldez Please help!

Works for me verbatim. How are you invoking traefik ?

Fixed. I need to add

[entryPoints.api]
    address = ":8080"

to the config.toml.