File size: 1,915 Bytes
746d2f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: st.experimental_user
slug: /develop/api-reference/utilities/st.experimental_user
description: st.experimental_user returns information about the logged-in user of private apps on Streamlit Community Cloud.
---

<Important>

This is an experimental feature. Experimental features and their APIs may change or be removed at any time. To learn more, click [here](/develop/quick-reference/prerelease#experimental-features).

</Important>

<Autofunction function="streamlit.experimental_user" />

### Examples

The ability to personalize apps for the user viewing the app is a great way to make your app more engaging.

It unlocks a plethora of use-cases for developers, some of which could include: showing additional controls for admins, visualizing a user's Streamlit history, a personalized stock ticker, a chatbot app, and much more. We're excited to see what you build with this feature!

Here's a code snippet that shows extra buttons for admins:

```python
# Show extra buttons for admin users.
ADMIN_USERS = {
    '[email protected]',
    '[email protected]',
    '[email protected]'
}
if st.experimental_user.email in ADMIN_USERS:
    display_the_extra_admin_buttons()
display_the_interface_everyone_sees()
```

Show different content to users based on their email address:

```python
# Show different content based on the user's email address.
if st.experimental_user.email == '[email protected]':
    display_jane_content()
elif st.experimental_user.email == '[email protected]':
    display_adam_content()
else:
    st.write("Please contact us to get access!")
```

Greet users with their name that's stored in a database:

```python
# Greet the user by their name.
if st.experimental_user.email:
    # Get the user's name from the database.
    name = get_name_from_db(st.experimental_user.email)
    st.write('Hello, %s!' % name)
```

<Autofunction function="streamlit.experimental_user.to_dict" />