Enable autologin into flask app using active directory Enable autologin into flask app using active directory flask flask

Enable autologin into flask app using active directory


It has taken me weeks to find the answer but Yes it is possible but you must configure the server where your app is hosted to allow this. In my case I was using IIS and enabled windows authentication.With this its surprisingly easy to get the active directory user name as it comes as part of the HTTP response:

from flask import requestusername = request.environ.get('REMOTE_USER')

See this question for more information:

How to access Apache Basic Authentication user in Flask