Pass argument from Flask do Dash - what's the best practice?


This is at least third post on this forum re topic of how to pass argument from Flask to Dash. However, I am looking for “best practice” solution.

The scenario is as follows:

  • I log in in Flask app
  • then I can run Dash
  • Dash needs to know which user is logged in and a few other arguments (DataTable editable or not, etc.)
  • altogether it has to be secure as we do not want one user to be able to see data for the other user and information that needs to be exchanged between Flaks and Dash is relatively small

What’s the best way to exchange info form Flask to Dash?

Option 1: write info to session

  • Flaks writes to session
  • Dash reads from session
  • ok from small pieces of data
  • however, not secure :confused:
  • hint here

Option 2: dcc.Location (documentation)

  • so simple info exchange via url
  • looks for for simple elements, but not that secure (I can easily modify url)
  • some problems spotted
  • any way to secure/encrypt info in url?

Any other idea? I was thinking of caching, but going for redis seems like using a cannot to kill a fly.

I would be grateful for any good hints.