Multipage streamlit app with user login

I love the new multipage feature but was curious is there is a way to integrate user logins with the multipage aspects of a page. For example, my current app has a user login on the sidebar. If the user is an admin they have access to 3 ‘pages’ of the app whereas if they are an employee they have access to just 1 ‘page’ (ie. admin have access to pages A, B, and C after logging in and employees just have access to page A). Is there a way that I can incorporate this work flow into who is able to see the various pages? Ideally there would be a login option first and the pages would only display after someone logs into the system. An admin would then see all pages and an employee would only see the one single page. Thanks!


I am also interested in this functionality for my application. Did you have any information or news?

You could use this implementation which allows you to control which pages are seen based on authentication type.

I have the same question. Did you have any information or news?

Thanks but that is not actually a solution based on their new implementation of multi page apps. I’m looking for a solution utilizing the new features just rolled out.

1 Like

I have not found one yet

I am also interested in learning of a way to do this.

1 Like

Hi - great question. Has any body made any progress on this? I was thinking about hacking it via a decorator, following login_required() in this example, but would love to see if anybody has thought about a different solution.


Are there any new findings on this topic?
Single login on a page and then different pages can be displayed depending on the login and role?

I’m also interested!
By the lack of answers, I’m assuming it’s currently not possible.
Would be great to see this feature in future versions :slight_smile:

Following… Great question and I hope some solution will pop-up in order to enable multiple users to use one app in a secured way.

I think this should work:

  1. On authentication, store the user role in st.session_state["role"].
  2. Add a guard clause at the beginning of every restricted page, so that it does nothing unles the role is appropriate:
if st.session.state.get("role") != "admin":
    st.error("You need to be an admin to access this page.")
1 Like

Did anyone find a solution to the problem?

I want to show the pages in multipage app after login successful. Is it still possible?

I think this solution would allow users to still view all available pages, just not the content of those pages. I don’t even want some users to know their access is restricted to certain pages. For example, Admin login sees page A, B, C. User login only sees page A, B - user isn’t even aware a page C exists.

The only possible way to do that with the standard pages feature would be deleting / creating / renaming files in the pages directory, in case it is possible at all. I wouldn’t recommend trying that anyway.

Using other approaches you can have more flexibility. There are some components out there but I have never used them. I personally use radio buttons or select boxes, that I can change at will.

Hi there!
I’m also interested on this topic. It would be great to have such a great solution, as everything that Streamlit does !

I also have not found a good way of doing this. The st-pages packages came close but:

  1. show_pages affects the app for all users on the server.
  2. hide_pages only occurs after the page loads…so there is still a flicker of all the available pages before they get hidden. So close.

This would be an amazing feature to have in dashboarding!

Hello! Does anyone know how to do a global authentication? So meaning once they authenticate, they can view all the pages in the multipage app. cos right now, what i’m struggling with is that the authentication is only for the specific page that they are on. thank you so much, pls help!

Yes I am looking for this too! Does anyone know of a solution? I only want to show the sidebar AFTER the user has logged in. But the sidebar is collapsed before that

yes I have this working - you need to use the st.session_state var which is passed page to page.

I use it with Cognito and mainly based my code off this: