Multi URL in same streamlit app

Hello, I need to integrate third-party authentication into my Streamlit app, which essentially enables users to proceed in the app after authentication. The problem is the only way to communicate with this third-party tool is by supplying a redirection URL if there is a successful authentication and nothing else. This means that if a user is successfully authenticated, it will return the main URL, which is essentially the only URL that Streamlit operates. This causes a change in session state and starts from the beginning of the app.

So, there are basically two ways of solving this issue. The first one is to persist session state along with different states, which does not seem to be possible. Another way is to create a multipage app where pages actually belong to different URLs. Is that something possible, or does anyone have an alternative idea for such an authentication funnel?

One common pattern I have seen is to use a query parameter on the redirect url, and when the main page loads, check for that query parameter, and handle the logging in if that query param is valid, and then set the login status in the session state. That way, even though the session state is empty, it gets populated correctly if you have a valid query param from a redirect.

1 Like

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