Skip to main content

Streamlit component for Firebae auth

Project description

streamlit-firebase-auth

Overview
streamlit-firebase-auth is a lightweight Streamlit component library that simplifies integrating Firebase Authentication into your apps. It provides built-in widgets for login and logout functionalities as well as session management utilities, enabling you to quickly add secure, Firebase-powered user authentication to your Streamlit projects.

Install

pip install streamlit-firebase-auth

Quick Use

from streamlit_firebase_auth import FirebaseAuth

auth = FirebaseAuth(
        {
            "apiKey": "YOUR_API_KEY",
            "authDomain": "YOUR_AUTH_DOMAIN",
            "projectId": "YOUR_PROJECT_ID",
            "storageBucket": "YOUR_STORAGE_BUCKET",
            "messagingSenderId": "YOUR_MESSAGING_SENDER_ID",
            "appId": "YOUR_APP_ID",
        })

login_user = auth.check_session()

if login_user:
    auth.logout_form()
else:
    suth.login_form()

API Reference

auth.login_form()

Description:
Displays a login form to the user and returns the result of the login attempt.

Return (dict):

  • success (bool): True if login was successful; otherwise, False.
  • message (str, optional): An error message if the login failed.

auth.logout_form()

Description:
Displays a logout interface and performs logout operations (like clearing the session).

Return (dict):

  • success (bool): True if logout was successful; otherwise, False.
  • message (str, optional): An error message if the logout failed.

auth.check_session()

Description:
Checks the current session to determine if the user is authenticated.

Return (dict):
A dictionary containing the user information provided by Firebase upon successful login.

auth.signup(email: str, password: str)

Description: Signs up a new user using Firebase Admin. This function creates a new user account and returns the result of the signup.

Return (dict):

  • success (bool): True if the signup was successful; otherwise, False.
  • message (str, optional): An error message if the signup failed.

auth.send_password_reset_email(email: str)

Description: Sends a password reset email to the specified email address. This function handles the email sending process and returns the result.

Return (dict):

  • success (bool): True if the email was sent successfully; otherwise, False.
  • message (str, optional): An error message if sending the email failed.

Detailed Usage

Please refer to the example for detailed usage.

Run :

streamlit run example/app.py

Image

Image

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

streamlit_firebase_auth-1.1.6.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_firebase_auth-1.1.6-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file streamlit_firebase_auth-1.1.6.tar.gz.

File metadata

  • Download URL: streamlit_firebase_auth-1.1.6.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for streamlit_firebase_auth-1.1.6.tar.gz
Algorithm Hash digest
SHA256 aaf1f9155d9f45808ac5a82275f1067386a5f631c75092033a55163830f65d44
MD5 22ee7a39024c78346585042838c91e02
BLAKE2b-256 0c2204f7af08c7e35d0d7ca44b381388d75044a9377e35fa4f3833e3ed8c3876

See more details on using hashes here.

File details

Details for the file streamlit_firebase_auth-1.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_firebase_auth-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ff14e3ad27d05c0ea7ee9e93bc67ade1c77089d561ab18f30aed4f6bf9f34e7b
MD5 e031e96aa839e52ee1045bfbd15b65e4
BLAKE2b-256 d2463ffbc671e4e25837c57c6658a053e67368fbd30fe63fbeeff3602c9fd542

See more details on using hashes here.

Supported by

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