AttributeError: module 'streamlit' has no attribute 'user'

  1. Are you running your app locally or is it deployed?
    1. My app is deployed as an Azure web app.
  2. Share the Streamlit and Python versions.
    1. Python 3.11
    2. Streamlit 1.42.0

Hello. I am trying to use Microsoft Entra to set up authentication for my streamlit app.

Here is my code:

try:
    if not st.user.is_logged_in:
        st.login()
except:
    st.login()
st.write(f"user info dict: {dir(st.user)}")

When I navigate to the URL and port for the streamlit app, this successfully redirects me to a sign-in page. However, after I sign in, when I am redirected back to the streamlit app, I get the error saying “streamlit has no attribute ‘user’”. What is going on here? I am trying to get the user email etc. from the authentication.

Thank you for your help.

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