Summary
I built Streamlit app consists of a browser, AWS ALB, Streamlit App, and resource server in that order.
To authorize the requests at the resource server, I configured AWS ALB authentication.
But I couldn’t implement logout function.
The AWS document says, “When an application needs to log out an authenticated user, it should set the expiration time of the authentication session cookie to -1 and redirect the client to the IdP logout endpoint (if the IdP supports one).”
Steps to reproduce
I implemented logout button linking to the IdP(Auth0) logout endpoint and it works well.
But when I access to the app again after logout, I can access the app without login. I guess it is because AWS ALB is still having the authentication session between my browser.
That’s why the AWS documents says, “it should set the expiration time of the authentication session cookie to -1”.
I tried to get the authentication session using _get_websocket_headers like below, but I couldn’t.
Code snippet:
import streamlit as st
from streamlit.web.server.websocket_headers import _get_websocket_headers
headers = _get_websocket_headers()
st.write(headers)
Expected behavior:
I think I can get the authentication session at the streamlit app as well as the browser developer tool can get.
but the _get_websocket_headers of the app could get “AWSALBAuthNonce”,
on the other hand, the browser could get two cookies, “AWSALBAuthNonce” and “AWSELBAuthSessionCookie-0”.
AWSELBAuthSessionCookie-0 is just what I want to get.
Debug info
- Streamlit version: 1.23.1
- Python version: 3.8.10
- Browser version: Google Chrome 114.0.5735.199
Requirements file
streamlit
extra-streamlit-components
I would appreciate it if someone could help me.