Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Accessing request headers in Dash

Hello,

I’m using the basic access authentication in Dash. Is there a way to access the request header via Dash? I’d like to parse the username from the request so that I can automatically populate some values in my app based on the logged in user.

Many thanks

I am using flask.session to store such things as user and session tokens.
Take a look here: http://flask.pocoo.org/docs/0.10/quickstart/#sessions

On authentication simply save what you need in flask.session dictionary, and remove those values on logout.