# Streamlit Authenticator: Logout - Are you sure message?

**URL:** <https://discuss.streamlit.io/t/streamlit-authenticator-logout-are-you-sure-message/64125>\
**Category:** streamlit-authenticator\
**Tags:** discussion\
**Created:** [March 7, 2024, 2:22pm UTC](https://discuss.streamlit.io/t/streamlit-authenticator-logout-are-you-sure-message/64125 "2024-03-07T14:22:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarnath\_K](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/sarnath_k/32/23028_2.png) [@Sarnath\_K](https://discuss.streamlit.io/u/Sarnath_K)\
**Post date:** [March 7, 2024, 2:22pm UTC](https://discuss.streamlit.io/t/streamlit-authenticator-logout-are-you-sure-message/64125/1 "2024-03-07T14:22:41Z")

</div>

I am using “streamlit\_authenticator” package to display login screen for my app. It’s a nice piece of work. Thank you Mohammad Khorasani!

I need a little control over my “logout” button. I want to ask the user “Are you sure you want to logout?” / “Are you sure to abandon your work?” etc.

How do I do this?

**LATER**  
Ferdy gave a nice workaround. But as advised by Ferdy, I did raise an issue with the streamlit-authenticator package. You can find it [here](https://github.com/mkhorasani/Streamlit-Authenticator/issues/142). Thank you @ferdy.  
The solution given in that thread by the author of the package is the best solution for this.  
The “ **logout** ” function takes “ **unrendered** ” as one of the values for the “ **location** ” parameter. When passed like that, it will perform the logout operation without rendering the button. So this allows us to render a button, ask for confirmation etc. and then call the actual **logout()** function with **location** parameter set to “ **unrendered** ” to perform the actual logout. That’s a neat design. Thanks to author of Streamlit-authenticator ( **Mr. Mohammad Khorasani** )

---

<div class="post-metadata">

**Author:** ![ferdy](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ferdy/32/29957_2.png) [@ferdy](https://discuss.streamlit.io/u/ferdy)\
**Post date:** [March 7, 2024, 11:52pm UTC](https://discuss.streamlit.io/t/streamlit-authenticator-logout-are-you-sure-message/64125/2 "2024-03-07T23:52:26Z")

</div>

This is not supported. However you can raise an issue in its [repo](https://github.com/mkhorasani/Streamlit-Authenticator) asking this feature.

In the meantime you can create a custom logout system, that adds one layer of logout verification.

 ![image](https://global.discourse-cdn.com/streamlit/original/3X/7/8/78f24e08974de4f0c8599916b80ee7c889b5c900.png)

The logout buttton will only be shown if the user tick the checkbox.

# code

```auto
if st.session_state["authentication_status"]:
    with st.container(border=True):
        st.subheader('Logout')
        st.checkbox('Verify logout', key='verify_logout')
        if st.session_state.verify_logout:
            authenticator.logout()
        
    st.write(f'Welcome *{st.session_state["name"]}*')
    st.title('Some content')

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [March 12, 2024, 10:09am UTC](https://discuss.streamlit.io/t/streamlit-authenticator-logout-are-you-sure-message/64125/3 "2024-03-12T10:09:36Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
