let say ,
import dash_auth
Keep this out of source code repository - save in a file or a database
VALID_USERNAME_PASSWORD_PAIRS = {
‘hello’: ‘world’,‘user2’:‘pass2’
}
external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
app = Dash(name, external_stylesheets=external_stylesheets)
auth = dash_auth.BasicAuth(
app,
VALID_USERNAME_PASSWORD_PAIRS
)
app.layout = html.Div([
html.H1(‘Welcome to the app’),
html.H3(‘You are successfully authorized’),
dcc.Dropdown([‘A’, ‘B’], ‘A’, id=‘dropdown’),
dcc.Graph(id=‘graph’)
], className=‘container’)
@app.callback(
Output(‘graph’, ‘figure’),
[Input(‘dropdown’, ‘value’)])
def update_graph(dropdown_value):
return {
‘layout’: {
‘title’: ‘Graph of {}’.format(dropdown_value),
‘margin’: {
‘l’: 20,
‘b’: 20,
‘r’: 10,
‘t’: 60
}
},
‘data’: [{‘x’: [1, 2, 3], ‘y’: [4, 1, 2]}]
}
if name == ‘main’:
It is possible to get the information inside the dash layout which user is logged in?
kindly share your ideas to get the user name inside the layout . I have to show that in web app