Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamlit-google-oauth

An example Streamlit application that incorporates Google OAuth 2.0

PIP

pip install git+https://github.com/hunkim/streamlit-google-oauth

Setup Google OAuth client ID

image

Make sure people api is enabled

image

Put client id, etc. in st.secrets

Add login in your streamlit app

import streamlit as st
import streamlit_google_oauth as oauth

client_id = st.secrets["GOOGLE_CLIENT_ID"]
client_secret = st.secrets["GOOGLE_CLIENT_SECRET"]
redirect_uri = st.secrets["GOOGLE_REDIRECT_URI"]

if __name__ == "__main__":
    login_info = oauth.login(
        client_id=client_id,
        client_secret=client_secret,
        redirect_uri=redirect_uri,
        login_button_text="Continue with Google",
        logout_button_text="Logout",
    )
    if login_info:
        user_id, user_email = login_info
        st.write(f"Welcome {user_email}")
    else:
        st.write("Please login")

Run streamlit with google oauth

streamlit run app.py --server.port 8080

Quick demo screenshots

Quick demo

About

An example Streamlit application that incorporates Google OAuth 2.0

Resources

Stars

51 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages