Embed streamlit apps in iframes

Hi everyone!

First of all thanks for the extreme work done by the Streamlit team, and thanks for how helpful, compact and valuable is this community, I’ve always found all the answers I needed here!

I am building a small portal with Next.js, using AWS Amplify as a backend to manage user authentication, data storage, and so on.

Parallel to this, I have some private routes, where I want to embed streamlit app so that my user can interact with them.

The general use case scenario, is that a user logs in into my app, and then a dropdown menu shows the availbale apps (tasks) they have, meaning that one user can have multiple apps associated with his account.

My question is, how can deploy and programmatically launch different apps based on the user currently logged in and based on the task he selected?

Ideally, those apps must be accessible only by the designated and authenticated user. Moreover, I would like to find a way to launch an app when the user selects that particular task from his dropdown menu.

So far, I have a table containing all the tasks and a user id representing the owner of this task, hence, to display a dropdown menu with all the tasks related to that particular user is pretty trivial. In addition, I know I could play with the Next.js router to programmatically display content based on the path.

However, I am not sure what could be the best approach to embed the user-related Streamlit app so that the user can “play” with it.

Thanks a lot for any possible suggestion or resource I could get!