Dash Authentication for MultiPage Apps?

Hi everyone,

I was following this video tocreate an authentication for my app.
My app consists of multiple pages.
I input the following code into my main file (app.py) which is launching the whole app with all the pages:

import dash_auth

...

auth = dash_auth.BasicAuth(
    app,
    {"test":"testpw"}
)
...

But app stops working and all I am getting is this:
image

Any ideas what I am doing wrong?
Thanks in advance.

Anyone ? :slightly_smiling_face:

Hello @mrel,

Have you looked into using something like flask-login?

Or flask-dance? :upside_down_face:

Hi, @jinnyzor , @Emil ,

No, I have not tried Flask yet.
I wanted to confirm first if I am doing something wrong or authentication is simply not working with multi-page apps.

Am I correct in understanding that authentication is not working with multi-page apps and I should be looking into flask ?

Hi @mrel

dash-auth does work with multi-page apps. You can see an example here:

It is however, very, very basic auth. It simply brings up a sign-in popup before the app starts. If you would like more control over access to certain pages or features, then a different option such as flask would be a better way to go.

Are you seeing this screen? If not, what browser are you using?

1 Like

Thank you, @AnnMarieW .

As you said, it does work.
What was causing the problem was the path parameter in the main homepage of the app.
It wasn’t working, because it had it was path="/Summary".
As soon as I changed it to path="/" it started working.

dash.register_page(
    __name__,
    path="/",
    name="Summary",
    order=1,
)
1 Like