Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi Team,
I am trying to capture the user who is running the webapp as it is shared environment. sometimes it is capturing correctly and sometimes not. It is just showing the one you who started the webapp and displaying the same for every run even some other user runs it. I want to capture the user who is running the dataiku webapp.
Here is my code:
import dataiku
client= dataiku.api_client()
auth_info= client.get_auth_info()
user= auth_info[โauthIdentifierโ]
print(user)
Operating system used: Windows
Operating system used: Windows
Hi @Anony123 ,
If you have python backend to your webapp you can use the following to obtain the user that currently viewing the webapp. Not the "run as" user.
python code:
@app.route('/get_current_user')
def get_user():
request_headers = dict(request.headers)
auth_info_browser = dataiku.api_client().get_auth_info_from_browser_headers(request_headers)
logging.info((auth_info_browser))
return auth_info_browser
JavaScript code:
$.getJSON(getWebAppBackendUrl('/get_current_user'), function(data) {
console.log('Received data from backend', data)
const output = $('<pre />').text('Backend reply: ' + JSON.stringify(data));
$('body').append(output)
});