Skip to main content

st_googleauth is a Python library that provides Streamlit integration for Google Authenticator. It enables single sign-on (SSO) with Google Authenticator for Streamlit applications.

Project description

StreamlitGAuth

StreamlitGAuth is a Python library that simplifies the integration of Google Authenticator-based Single Sign-On (SSO) with Streamlit applications. With StreamlitGAuth, you can enhance the security of your Streamlit apps by enabling two-factor authentication through Google Authenticator.

Sample image

Installation

You can install StreamlitGAuth using pip

Usage

import streamlit as st
from StreamlitGauth.google_auth import Google_auth

client_id = ""
client_secret = ""
redirect_uri = "http://localhost:8501"

login = Google_auth(
    clientId=client_id, clientSecret=client_secret, redirect_uri=redirect_uri
)

if login == "authenticated":
    st.success("hello")
    pass

Replace "your_client_id" and "your_client_secret" with your actual Google OAuth 2.0 credentials.

Example Streamlit Application

import streamlit as st
from StreamlitGauth.google_auth import Google_auth


client_id = "hasjh5jk498ufiu3h89g8-aghdszjhk3k.apps.googleusercontent.com"
client_secret = "afsghfbkhfdjdsgfdjhfjkfhjkfhkjhkjdhks"
redirect_uri = "http://localhost:8501"

login = Google_auth(clientId=client_id, clientSecret=client_secret, redirect_uri=redirect_uri)

if login == "authenticated":
    # your streamlit applciation
    pass

else:
    st.warning("login failed")

Contributing

If you would like to contribute to StreamlitGAuth, please open an issue or submit a pull request on our GitHub repository.

License

This library is released under the MIT License to encourage collaboration and use in various applications.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

StreamlitGAuth-2.0.9.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

StreamlitGAuth-2.0.9-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page