Authentication for multi-page apps

I have seen some similar questions posted before it seemed like no one had a good solution so I thought I’d try again. I have a multi-page dash app in which users can click links to navigate between pages. I am using dash_auth which works fine for the home page but not for anything else. I would like users to be able to go directly to one of the linked URLs but if they have not authenticated before, then they will get an error loading the page.

Is there a way to force authentication on each page of my dash? I know dash runs on Flask so maybe there is a Flask way I can implement? Or a redirect system that sends you first to the home page to authenticate and then redirects you to the link originally request…I am not sure how to do this. Any and all help would be much appreciated!

2 Likes

Hi @eambrioso thank you for your post, it is a bit complex but you can apparently do it with Flask-login.
Please have a look at this link for further details on the implementation:

Hope this helps

4 Likes

Thank you! It was a bit complex but I was able to figure it out with the link you sent as well as this one: Securing Plotly Dash using Flask-Login - DEV Community

2 Likes

Great, thanks for sharing! Will/Did you also implement a password recovery system?

1 Like

No it is a very simple login system so I will not have to do this. The users won’t be creating their own logins, it is just a couple of usernames/password combos that we send out to them.

@eambrioso , please, can you post your solution? Is it working smoothly?

1 Like