How to get client IP address and device os for login authentication security

Is there a mechanism that works to get the client IP address ( internet) and device details like OS / browser etc. to implement security for users , how can this be implemented i tried a few ways (ipify.org etc.) but it returns localhost/127.0.0.1 for me always. On hosting the code on the server it returns the server IP Address.

Browser: access the User-Agent exposed by st.context.headers. Here is some docs on what to do and how to interpret user agent information:


IP address: there is an old discussion on GitHub Log connected IPs and client information to console and/or file · Issue #602 · streamlit/streamlit · GitHub. In a nutshell, Streamlit does not support getting that information natively.

1 Like

Thanks this was helpful. getting client side IP seems to be an issue