I am currently making a Dash app which would show different layout based on user privilege, so I would like to be able to identify the user which is signed up. I'm using Basic Auth and I changed some lines in dash_auth/basic_auth.py: Original:
username_password_utf8 = username_password.decode('utf-8')
username, password = username_password_utf8.split(':')
to:
username_password_utf8 = username_password.decode('utf-8')
username, password = username_password_utf8.split(':')
self._username = username
Unfortunately, I received the : AttributeError: 'BasicAuth' object has no attribute '_username' error when I tried to use the _username attribute from auth.
app.layout = html.Div(
html.H3("Hello " + auth._username)
)
I understand that the Dash app is already processed before authorization check, but I have no idea where to implement a callback that changes the layout according to username. How can I get the username in the Dash application?