✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Dcc store with dcc location

@app.callback([Output('content', 'children'),
               Output('store', 'data')],
              [Input('url', 'search')],
              [State('url', 'pathname')])
def set_session_data(search, pathname):
    isverifieduser = False
    pathname = str(pathname)
    if pathname == 'None' or pathname == '/':
        return [no_update, no_update]
    elif pathname.startswith('/login'):
        token = str(search.split('?')[-1])
        if token:
            with open(r'C:\Users\Pcs\Desktop\infinity\cert.pem', 'rb') as pem_file:
                file = pem_file.read()
                cert_obj = load_pem_x509_certificate(file, default_backend())
                pub_key = cert_obj.public_key()
                tkn = jwt.decode(token, pub_key, algorithms=['RS512'])
                isverifieduser = True
                if tkn['exhibitorid'] is None:
                    data = dict(id=tkn['id'], role=tkn['role'])
                    data = dict(id = tkn['id'], role = tkn['role'], exhibitorid = tkn['exhibitorid'])
                return [dcc.Location(pathname='/dashboard', id = 'route-from-login'), data]
            except Exception as e:
            return login layout

    elif pathname.startswith('/dashboard'):
        #check role and return layout accordingly
        return [dashboard_layout, no_update]

Can I access dcc store data from the last elif statement so that I can return the respective layout based on the user role that I have decoded from the jwt token above? Thanks i advance :slight_smile: