I have a multi-page app following the instructions here.
To simplify a little bit, the app structure is something like this:
- app.py - index.py - apps |-- __init__.py |-- app1.py |-- app2.py
I’m able to set Dash Auth to work so that if the user goes to the “landing page” (when debugging, localhost:8050) it prompts the user to log in using the Plotly account. However, if the user goes to, for example, localhost:8050/apps/app1, they get a 403 error (Forbidden).
The behavior I would like to have is one of the following:
- The user goes directly to localhost:8050/apps/app1 and instead of the 403 error he/she gets prompted to authenticate and then is redirected to the page that was initially requested.
Or if this is not possible:
- The app is redirected to localhost:8050 if the user tries to access a sub page and they aren’t authenticated yet.
I tried the second approach using the
@auth.is_authorized_hook decorator but haven’t had much success yet. Does anyone know if what I’m trying to do is possible?