Python Forum

Full Version: Get username
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!
I have Flask app with CherryPy webserver. I need to do authentication using Active Directory. I can get user data from Active Directory but dont know how to get username(windows) from the user who launched my webapp. Are there any ways to get current user name(windows login)?
The module os can help you.

deadeye@nexus ~ $ import os                                   
deadeye@nexus ~ $ os.getuid()                                 
1000
deadeye@nexus ~ $ os.getlogin()                               
'deadeye'
deadeye@nexus ~ $
Don't worry, it's not inside a Python REPL, it's XONSH.
Module os and getpass do not work as I need.
when I use the specified module(os or getpass), it always returns the data of a user authorized on the server where my application is installed. I would like to receive the data of the user who opened my application on his computer in a browser