Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

How to print/capture the user who is using the Webapp from browser header

Level 2
How to print/capture the user who is using the Webapp from browser header

Hi All,

I'm using dataiku version 9.0.7 and have a requirement to print/capture the user who is using/accessing the Dash webapp to apply data security filter.  I tried using below code but below code always returns who is initiated the web app but not the user who is using it.


I also tried using below code but below code is not working for me. Please help me on this.

#new_browser_user=client.get_auth_info_from_browser_headers(headers_dict, with_secrets=False)

 Thanks in advance!

Operating system used: Windows

0 Kudos
1 Reply
Developer Advocate


Here is a very small example to retrieve the authenticated user :

import logging

from flask import request
from dash.dependencies import Input, Output, State

    Output('my-output', component_property='children'),
    [Input('dummy', 'children')]
def get_logged_user(_):
    request_headers = dict(request.headers)
    auth_info_browser = dataiku.api_client().get_auth_info_from_browser_headers(request_headers)
    return auth_info_browser["authIdentifier"]

app.layout = html.Div(children=[

To be able to retrieve the authenticated user, you need to set up a callback (@app.callback) that reacts to the load. That is why we set a "dummy" input, as this input will never change, and the callback will be executed once. You have to use a callback to access the request object.

You can not use this code (underneath) as it will retrieve the defined user on the settings page





0 Kudos