A read-only, dict-like object for accessing information about current user.
st.experimental_user is dependant on the host platform running the Streamlit app. If the host platform has not configured the function, it will behave as it does in a locally running app.
Properties can by accessed via key or attribute notation. For example, st.experimental_user["email"] or st.experimental_user.email.
| Class description[source] | |
|---|---|
st.experimental_user() | |
| Methods | |
to_dict() | Get user info as a dictionary. |
| Attributes | |
email (str) | If running locally, this property returns the string literal "test@example.com". If running on Streamlit Community Cloud, this property returns one of two values:
|
Community Cloud
Starting from Streamlit version 1.42.0, you can't use st.user to retrieve a user's Community Cloud account email. To access user information, you must set up an identity provider and configure authentication ([auth]) in your app's secrets. Remember to update your identity provider's configuration and your app's secrets to allow your new domain. A list of IP addresses used by Community Cloud is available if needed. An authentication-configured app counts as your single allowed private app.
Get user info as a dictionary.
This method primarily exists for internal use and is not needed for most cases. st.experimental_user returns an object that inherits from dict by default.
| Function signature[source] | |
|---|---|
st.experimental_user.to_dict() | |
| Returns | |
(Dict[str,str]) | A dictionary of the current user's information. |
Still have questions?
Our forums are full of helpful information and Streamlit experts.