st.user lets a Streamlit app inspect the authenticated user's identity and login status after an OpenID Connect login. Check st.user.is_logged_in to determine whether access is authenticated, or read st.user.email to identify the user. section 8.4.3
Check authentication status
import streamlit as st if st.user.is_logged_in: st.write(f"Signed in as {st.user.email}") else: st.write("Please log in") section 8.4.3
Use st.user as part of Streamlit's OIDC authentication flow:
- Configure an OIDC-supported identity provider such as Google, Microsoft, Okta, or Auth0, storing the client details and metadata in st.secrets. section 8.4.3
- Start authentication with st.login, then inspect st.user in the app; end the session with st.logout. section 8.4.3
- For Streamlit 1.44.0 or earlier, the corresponding object may be named st.experimental_user. section 8.4.3
