How can I securely direct a user from a flask service to a streamlit service while passing over an id so I can identify the user?

:wave:t2: I’m trying to create an open source example of building a streamlit Shopify App.

Question: If I deploy streamlit and flask on 2 separate services using docker-compose (like here) and I can authenticate a user through the flask service (like here). How can I securely direct the user from the flask service to the streamlit service while passing over an id so I can identify the user?

Process I’m thinking is this:

  1. User installs app for their Shopify store, when this happens I will start downloading their order data using the flask app (like here) and storing it in a database.
  2. Once a user visits the app in their Shopify admin I want to direct them to the streamlit service and pass along some id (using flask redirect while passing arguments, or message flashing) so I know which store I need to filter to when showing order details in their dashboard.

I’m new to flask/docker/networking, so any feedback/suggestions on how to do this securely (even if it’s entirely different than the process I outlined above) would be much appreciated!
Like should I get them to login again on the streamlit dashboard?

Here’s what I’ve got so far: GitHub - parker84/shopify-streamlit-example: A simple Shopify app created using Flask and Python
I’m able launch both services locally, and can then authenticate the user through the flask app.

Also: I’m thinking of deploying these as 2 separate heroku apps (because I can’t have 2 web services deployed through the same heroku app for free).

Maybe the best approach would be to submit a post request to the flask service from the streamlit service using the shopify app secrets to ensure it’s secure?

If the user shows up on the streamlit dashboard directly, force them to first login to through the flask app before the dashboard shows their results.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.