I have made a few streamlit apps and am running them on a linux server in docker containers. I want to develop a landing page of sorts that authenticates a user and then shows them the apps they have access to.
The basic logic is as follows:
User navigates to myserver
They get proxied by NGINX to a Fast API landing page
In FastAPI if they are logged in they see what streamlit apps they have access to and can navigate to them
Else they are authenticated against a DB and then shown apps they have access to and then navigate to them.
I can’t get the navigation piece to work. Like how do I route a user to a streamlit app without redirecting them entirely to a different page. I have been looking at mounting the streamlit app, requesting it using websockets or embedding it using iframes in html. As of right now I can only get the iframes to work.
What we’ve done is add authentication into our Streamlit app using the new methods that give access to HTTP headers, with authentication handled by a proxy that adds user details as headers.
So the proxy handles the authentication before forwarding the request to Streamlit, and our app uses the headers to identify the user and work out which “views” are appropriate for them. Each view is a separate module that gets rendered when selected by the user (we did this before multi-page apps were a thing).
I use st.context to get a cookie with login info and that handles authentication. The authentication is handled using fastapi and then users can navigate to the streamlit apps they have access to from a home page. I am still iframing my streamlit apps into an html template with a html navigation bar so users can navigate between multiple apps.
It works pretty well but would still love native rerouting in streamlit
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.