Skip to main content

Login page with Streamlit (Lables of widgets are in Frensh language)

Update of https://github.com/GitSamad88

#Version 2024-3-29 : this version is an update of streamlit-login-auth-ui-23

  • streamlit 3.31.1
  • trimmed requirements.txt
  • removed name from user
  • attempt to fix cache deprecated in imported module streamlit-cookies-manager==0.2.0 latest Version!
  • store user's authentifications in a Google Sheets file as a database.
  • connect with the user using STMP Gmail.

HOW TO INSTALL ALL LIBRARIES:? python3.10 -m venv venv source venv/bin/activate python3.10 -m pip install -r requirements.txt

Streamlit Login/ Sign Up Library Downloads

The streamlit_signin_auth_ui library is meant for streamlit application developers. It lets you connect your streamlit application to a pre-built and secure Login/ Sign-Up page and store user's data in Google Sheets.

You can customize specific parts of the page without any hassle!

The library grants users an option to reset their password, users can click on Forgot Password? after which an Email is triggered containing a temporary, randomly generated password.

The library also sets encrypted cookies to remember and automatically authenticate the users without password.
The users can logout using the Sortir button.

Authors

PyPi

https://pypi.org/project/streamlit_signin_auth_ui/

The UI:

connect
pip install streamlit_signin_auth_ui

How to implement the library?

To import the library, just paste this at the starting of the code:

from streamlit_signin_auth_ui.widgets import __login__

All you need to do is create an object for the __login__ class and pass the following parameters:

  1. self
  2. credentials : The credentials to connect with Google Sheets API. you have to enable Google Sheets API and create credentials, visit : Google Cloud Console
  3. smtp_username : username to login to your SMTP Gmail account
  4. smtp_password : password to login to your SMTP Gmail account
  5. company_name : This is the name of the person/ organization which will send the password reset email.
  6. width : Width of the animation on the login page.
  7. height : Height of the animation on the login page.
  8. logout_button_name : The logout button name.
  9. hide_menu_bool : Pass True if the streamlit menu should be hidden.
  10. hide_footer_bool : Pass True if the 'made with streamlit' footer should be hidden.
  11. lottie_url : The lottie animation you would like to use on the login page. Explore animations

Mandatory Arguments:

  • company_name
  • width
  • height

Non Mandatory Arguments:

  • logout_button_name [default = 'Sortir']
  • hide_menu_bool [default = False]
  • hide_footer_bool [default = False]
  • lottie_url [default = https://assets8.lottiefiles.com/packages/lf20_ktwnwv5m.json]

After doing that, just call the build_login_ui() function using the object you just created and store the return value in a variable.

Example:

import streamlit as st
from streamlit_signin_auth_ui.widgets import __login__

__login__obj = __login__(credentials=credentials_of_your_google_sheet_API, # must be .json or Python dictionnary.
                    smtp_username = 'your_email@gmail.com',
                    smtp_password = 'your password', # 16 caracters
                    company_name = "your_company_name", # mandatory
                    width = 400, height = 500,
                    logout_button_name = 'Sortir', hide_menu_bool = False,
                    hide_footer_bool = False,
                    lottie_url = 'https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json')



LOGGED_IN = __login__obj.build_login_ui()

if LOGGED_IN == True:
    st.success("Bienvenue!")

That's it! The library handles the rest.
Just make sure you call/ build your application indented under if st.session_state['LOGGED_IN'] == True:, this guarantees that your application runs only after the user is securely logged in.

Explanation

Login page

The login page, authenticates the user.

connect

Create Account page

Stores the user info in a secure way in the google-sheet file. as a database \

creat-account

Forgot Password page

After user authentication (email), triggers an email to the user containing a random password. \

get-password

Reset Password page

After user authentication (email and the password shared over email), resets the password and updates the same
in the google-sheet file. \

edit-password

Logout button

Generated in the sidebar only if the user is logged in, allows users to logout. \

loggin

Cookies are automatically created and destroyed depending on the user authentication status.

Version

v1.3.3

License

MIT

Metadata

Release files for streamlit-signin-auth-ui 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-signin-auth-ui 1.3.3
File Size Uploaded Provenance Actions
streamlit_signin_auth_ui-1.3.3.tar.gz 11.8 kB Without provenance Details for streamlit_signin_auth_ui-1.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-signin-auth-ui 1.3.3
File Interpreter ABI Platform Actions
streamlit_signin_auth_ui-1.3.3-py3-none-any.whl Python 3 none any Details for streamlit_signin_auth_ui-1.3.3-py3-none-any.whl

Total release size: 22.4 kB

Release files / streamlit_signin_auth_ui-1.3.3.tar.gz

Download URL streamlit_signin_auth_ui-1.3.3.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
799ba995a6e8b353da0ab2a9b6df9c536126425c63cd0ca46d44b4b68bd7dabf
BLAKE2b-256 checksum
How to use checksums
71432f6c22bd1a2b92f641f11fb1537c2db4c1878b3c562b71e6e96561c8d9d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / streamlit_signin_auth_ui-1.3.3-py3-none-any.whl

Download URL streamlit_signin_auth_ui-1.3.3-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8aa01ff34fb7aa45d30a518d91a0a8b06d0235dbe4aa1c3fcad97a50c0275ae3
BLAKE2b-256 checksum
How to use checksums
1788f5840a97ca14c42cbd71bfaba27fccd557a644dddfabd95e6ed5dad4a75b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Security for streamlit-signin-auth-ui 1.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page