I want to run a Dash application on a platform that - for security reasons - wants me to send an additional Header with each request made by Dash (such as clicking on a Button).
Technically the platform sets a cookie and wants me to send the content of the cookie in the request header.
Unfortunately I did not find any Example how to do this with Dash (or Flask or React.js).
This isn’t possible right now but we’re planning on adding support for this. This issue in particular has been sponsored by an organization, so we are looking at getting it in by around September. You can follow the progress here: https://github.com/plotly/dash-renderer/issues/65
I have a similar requirement - now that this feature has been merged are there any examples demonstrating how to achieve this? From what I understand I will need to do something along the lines of:
app.renderer = """
var renderer = new DashRenderer({
request_pre: (payload) => {
// some code here to set header
console.log(payload);
},
})
"""
Actually, every request sent by plotly dash front end to its back end contains the cookies, so you could copy the auth header contents from your browser local storage and save it as a cookie. While this isnt sending it in the headers to Plotly Dash backend, it will still get it.
Front end JSX can have something like this near your iframed dash