I’m having trouble with this as well. I have a streamlit app behind an ALB that uses Cognito for authentication. Ending a user’s session appears to require a call to Cognito’s logout endpoint and invalidating the session cookies (default name AWSELBAuthSessionCookie). The latter does not seem to be possible within streamlit - the cookies are HTTPOnly according to this thread.
I’ve attempted to read and set the session cookie’s value with extra-streamlit-components but the HTTPOnly cookies do not appear to be read by that package or _get_websocket_headers().
I ended up following the approach in this comment to monkeypatch the streamlit server, adding a logout request handler to delete the AWS session cookie. A user clicks a logout button which sends a GET request to the Cognito logout endpoint (which ends the user session from the auth server side) with a logout_uri arg pointing to my streamlit app’s new logout route to delete the cookie. Without the last step, subsequent requests to the ALB see the cookie and pass through authentication until the session cookie timeout is hit later.
Streamlit’s tornado server already has a number of extra routes for health checks, and it’d be nice to be able to extend that through a configuration instead of monkeypatching.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.