Auth multi dash instance on flask server

Hello,

I’d like to host multiple dashapp into a flak server. Each dashapp shall be accessible with a login and password.

Some users can access different dashapps, but for most of them I want allow access to only one user. Dashboards are very similar to each other, just data change.

I tried the dash_auth.BasicAuth. It works perfectly but only for one dashapp.

So I tried to authenticate with flask_httpauth. Here again, it works well for one dashboard, but not for 2 and more because of blueprints.

import dash
from flask import Flask, render_template, redirect, Blueprint
import dash_bootstrap_components as dbc
from flask_httpauth import HTTPDigestAuth

from apps.dashboard import Dashboard


app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello from Flask!'

#others routes

auth = HTTPDigestAuth()

users = {
    "john": "hello",
    "susan": "bye"
}
    
@auth.get_password
def get_pw(username):
    if username in users:
        return users.get(username)
    return None

url1 = '/dahsboard1'
dash_app1 = dash.Dash(__name__, server = app, external_stylesheets=[dbc.themes.BOOTSTRAP])
dash_app1.config.suppress_callback_exceptions = True
dash_app1.layout = Dashboard(dash_app1, 'data1', 'Title1', url1).layout
@app.route(url1)
@app.route(url1 + '/')
@app.route('/dash1')
@auth.login_required
def render_dashboard1():
    return dash_app1.index()

url2 = '/dashboard2'
dash_app2 = dash.Dash(name='app2', server = app, external_stylesheets=[dbc.themes.BOOTSTRAP])
dash_app2.config.suppress_callback_exceptions = True
dash_app2.layout = Dashboard(dash_app2, 'data2', 'Title2', url2).layout
@app.route(url2)
@app.route(url2 + '/')
@app.route('/dash2')
@auth.login_required
def render_dashboard2():
    return dash_app2.index()

if __name__ == '__main__':
    app.run(debug=True)

The error :

ValueError: The name '_dash_assets' is already registered for a different blueprint. Use 'name=' to provide a unique name.

How can I add different blueprint names for each dashapp created ? Or more generally, how can I manage authentification for several dashapps running on one flask server ?

Thanks you!