priority_high

Warning

You are reading the documentation for Streamlit version 1.33.0, but 1.52.0 is the latest version available.

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

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:

  • None if the user is not logged in or not a member of the app's workspace. Such users appear under anonymous pseudonyms in the app's analytics.
  • The user's email if the the user is logged in and a member of the app's workspace. Such users are identified by their email in the app's analytics.

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.

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.