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!

3 Likes

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.

Thanks
A

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.")
    st.stop()
1 Like