OAuth component for Streamlit

Hello all :wave:
I created a Python-only component that handles OAuth authentication to Streamlit apps. The component will “gate” your app until the user successfully authenticates with the OAuth provider. It’s as simple as:

import streamlit as st
from st_oauth import st_oauth

st.markdown("## This (and above) is always seen")
id = st_oauth('myoauth', 'Click to login via OAuth')
st.markdown("## This (and below) is only seen after authentication")

It supports multi-page apps and query parameters, as well!
I also wrote a brief blog post on how to use it: OAuth Component for Streamlit. One of the common requests I get when… | by Brian Hess | Streamlit | Apr, 2023 | Medium

Check out the GitHub repo here: GitHub - sfc-gh-bhess/st_oauth: OAuth component for Streamlit

5 Likes