<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to get logged in user name/email in the databricks streamlit app? in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101163#M2465</link>
    <description>&lt;P&gt;I have created a Databricks App using streamlit and able to deploy and use it successfully.&lt;/P&gt;&lt;P&gt;I need to get the user name/email address of the logged in user and display in the streamlit app. Is this possible?&lt;/P&gt;&lt;P&gt;If not possible at the moment, any roadmap for adding this feature?&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;satniks&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2024 06:21:27 GMT</pubDate>
    <dc:creator>satniks_o</dc:creator>
    <dc:date>2024-12-06T06:21:27Z</dc:date>
    <item>
      <title>How to get logged in user name/email in the databricks streamlit app?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101163#M2465</link>
      <description>&lt;P&gt;I have created a Databricks App using streamlit and able to deploy and use it successfully.&lt;/P&gt;&lt;P&gt;I need to get the user name/email address of the logged in user and display in the streamlit app. Is this possible?&lt;/P&gt;&lt;P&gt;If not possible at the moment, any roadmap for adding this feature?&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;satniks&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 06:21:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101163#M2465</guid>
      <dc:creator>satniks_o</dc:creator>
      <dc:date>2024-12-06T06:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logged in user name/email in the databricks streamlit app?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101244#M2472</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Yes, it is possible to retrieve and display the username or email address of the logged-in user in a Streamlit app deployed on Databricks. This can be achieved through two primary approaches:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. Using "st.experimental_user" in streamlit.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;import streamlit as st &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;# Access the user's email &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;user_email = st.experimental_user.get("email", "Unknown User") &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;# Display the email in the app st.write(f"Logged in as: {user_email}")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Using HTTP Headers in Databricks Apps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;import os &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;import streamlit as st &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;# Access headers passed by Databricks Apps &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;user_email = os.getenv("X-Forwarded-Email", "Unknown User") &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;# Display the user's email &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;st.write(f"Logged in as: {user_email}")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope this helps. Cheers, Louis.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 14:01:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101244#M2472</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2024-12-06T14:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logged in user name/email in the databricks streamlit app?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101390#M2479</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;user_email &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; st.context.headers.&lt;/SPAN&gt;&lt;SPAN&gt;get&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"X-Forwarded-Email"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;st.&lt;/SPAN&gt;&lt;SPAN&gt;write&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;"email: &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN&gt;user_email&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Dec 2024 00:53:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101390#M2479</guid>
      <dc:creator>Shannon_O</dc:creator>
      <dc:date>2024-12-09T00:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logged in user name/email in the databricks streamlit app?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101405#M2481</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/34815"&gt;@Louis_Frolio&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/135496"&gt;@Shannon_O&lt;/a&gt;&amp;nbsp; for your response.&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp;&lt;SPAN&gt;st.experimental_user.get() API but it gives me hardcoded response as&amp;nbsp;&lt;A href="mailto:test@example.com" target="_blank" rel="noopener noreferrer"&gt;test@example.com&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Suggestion to use&amp;nbsp;X-Forwarded-Email header worked and I got correct email address. Thanks for your help. I am unblocked now.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 06:25:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101405#M2481</guid>
      <dc:creator>satniks_o</dc:creator>
      <dc:date>2024-12-09T06:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logged in user name/email in the databricks streamlit app?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101407#M2482</link>
      <description>&lt;P&gt;&lt;SPAN&gt;X-Forwarded-Email worked. I assume you mean using&amp;nbsp;st.context.headers.get() instead of os.getenv().&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 06:30:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/101407#M2482</guid>
      <dc:creator>satniks_o</dc:creator>
      <dc:date>2024-12-09T06:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get logged in user name/email in the databricks streamlit app?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/113909#M3198</link>
      <description>&lt;P&gt;I have also tried to deploy a streamlit app, however I was not able to deploy it.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 15:14:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-get-logged-in-user-name-email-in-the-databricks-streamlit/m-p/113909#M3198</guid>
      <dc:creator>Carl_B</dc:creator>
      <dc:date>2025-03-28T15:14:59Z</dc:date>
    </item>
  </channel>
</rss>

